forked from FlowPhysics/flowVC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
93 lines (67 loc) · 1.58 KB
/
makefile
File metadata and controls
93 lines (67 loc) · 1.58 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
ifeq ($(OS),Windows_NT)
ifeq ($(shell uname -s),) # not in a bash-like shell
CLEANUP = del /F /Q
MKDIR = mkdir
else # in a bash-like shell, like msys
CLEANUP = rm -f
MKDIR = mkdir -p
endif
TARGET_EXTENSION=exe
else
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=out
endif
.PHONY: clean
.PHONY: all
PATHS = src/
PATHT = test/
PATHB = build/release/
PATHD = build/release/dependencies/
PATHO = build/release/out/
BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO)
SRCT = $(wildcard $(PATHT)*.c)
COMPILE=gcc -c
LINK=gcc
DEPEND=gcc -MM -MG -MF
LFLAG= -lm
# Set build mode
ifeq ($(mode),debug)
CFLAGS = -g -Wall -O0 -I. -I$(PATHS) -DDEBUG_LEVEL=1
else
mode = release
CFLAGS = -Wall -O3 -I. -I$(PATHS)
endif
all: info project
info:
ifneq ($(mode),release)
ifneq ($(mode),debug)
@echo "Invalid build mode."
@echo "Please use 'make mode=release' or 'make mode=debug'"
@exit 1
endif
endif
@echo "Building in "$(mode)" mode..."
# Define the output filename
OUTPUT_NAME = flowVC
# List of source files for your project
SRCS = $(wildcard $(PATHS)*.c)
# List of object files for your project
OBJS = $(patsubst $(PATHS)%.c,$(PATHO)%.o,$(SRCS))
# Target for building your project
project: $(BUILD_PATHS) $(OBJS)
$(LINK) -o $(PATHB)$(OUTPUT_NAME).$(TARGET_EXTENSION) $(OBJS) $(LFLAG)
# Dependency rule for object files
$(PATHO)%.o: $(PATHS)%.c
$(COMPILE) $(CFLAGS) $< -o $@
$(PATHB):
$(MKDIR) $(PATHB)
$(PATHD):
$(MKDIR) $(PATHD)
$(PATHO):
$(MKDIR) $(PATHO)
clean:
$(CLEANUP) $(PATHO)*.o
$(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION)
.PRECIOUS: $(PATHD)%.d
.PRECIOUS: $(PATHO)%.o