-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile
# Compiler and Flags
CC = gcc
CFLAGS = -Wall -Wextra -g
# Target Executable
TARGET = main.a.out
# Source Files
SRC_MAIN = main.c
SRC_MATRIX = matrix_functions.c
SRC_MODEL = model_functions.c
SRC_NODE = node_functions.c
# Header Files
HEADERS = matrix_functions.h model_functions.h settings.h node_functions.h
# Object Files
OBJ_MATRIX = matrix_functions.o
OBJ_MODEL = model_functions.o
OBJ_MAIN = main.o
OBJ_NODE = node_functions.o
# Default Target
all: $(TARGET)
# Link Object Files to Create Executable
$(TARGET): $(OBJ_MATRIX) $(OBJ_MODEL) $(OBJ_MAIN) $(OBJ_NODE)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJ_MATRIX) $(OBJ_MODEL) $(OBJ_MAIN) $(OBJ_NODE) -lm
# Compile matrix_functions.c to matrix_functions.o
matrix_functions.o: $(SRC_MATRIX) $(HEADERS)
$(CC) $(CFLAGS) -c $(SRC_MATRIX)
# Compile model_functions.c to model_functions.o
model_functions.o: $(SRC_MODEL) $(HEADERS)
$(CC) $(CFLAGS) -c $(SRC_MODEL)
main.o: $(SRC_MAIN) $(HEADERS)
# Compile main.c to main.o
$(CC) $(CFLAGS) -c $(SRC_MAIN)
# Compile main.c to main.o
node_functions.o: $(SRC_NODE) $(HEADERS)
$(CC) $(CFLAGS) -c $(SRC_NODE)
# Clean Build Artifacts
clean:
rm -f $(OBJ_MATRIX) $(OBJ_MODEL) $(OBJ_MAIN) $(OBJ_NODE) $(TARGET)
# Phony Targets
.PHONY: all clean