Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGEPRO makefile #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

# Visual Studio Code IDE settings
*.vscode
48 changes: 48 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Compiler Options
# Enable -Wall -Wextra for GCC compiler warning messages
C_FLAGS := # -Wall -Wextra
CC := gcc

# Include <math.h> library to compilation
LIBS := -lm

# Directories the makefile should search
VPATH := ./obj/ ./src/ ./bin/

#TARGET binary executable
TARGET := AGEPRO.exe

# Directory Variables
SRC_DIR := ./src
BIN_DIR := ./bin
OBJ_DIR := ./obj
EXE_PATH := $(BIN_DIR)/$(TARGET)

# Source Files
# Header files included in src directory
C_FILES := ranx.c boxmuller.c util.c
SRC_FILES := $(C_FILES:%.c=$(SRC_DIR)/%.c)
MAIN_FILE := $(SRC_DIR)/AgePro.c

# Object Files
OBJ_FILES := $(C_FILES:%.c=$(OBJ_DIR)/%.o)

# Build
all: $(OBJ_DIR) agepro
.PHONY: all

#Compile Object Files for non-main source code files
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(C_FLAGS) -c -o $@ $<

#Compile main file, and link object files to target executable.
agepro: $(OBJ_FILES)
@echo "[Info] Building Binary Executable [$(TARGET)]"
$(CC) $(C_FLAGS) -o $(EXE_PATH) $^ $(MAIN_FILE) $(LIBS)

# Cleanup
.PHONY: clean
clean:
echo "[Clean] Clean Object Files"
-rm -f $(OBJ_FILES)