-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (41 loc) · 1.02 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
54
55
56
57
58
TOPTARGETS=all clean
SUBDIRS=src
MKFILE_PATH=$(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR=$(dir $(MKFILE_PATH))
export ROOT_PROJECT_DIRECTORY=$(MKFILE_DIR)
export BIN_DIRECTORY=$(ROOT_PROJECT_DIRECTORY)bin/
export SCRIPT_DIRECTORY=$(ROOT_PROJECT_DIRECTORY)scripts/
export BUILD_SCRIPT_DIRECTORY=$(ROOT_PROJECT_DIRECTORY)build-scripts/
export CC=clang
export AS=nasm
export LD=/usr/local/opt/llvm/bin/ld.lld
export EXTENSION=c
ifeq ($(DEBUG),1)
override CFLAGS+= -DDEBUG=1 -g -O0
else
override CFLAGS+= -O3
endif
override CFLAGS+= -Wall -Wextra
override CFLAGS+= -masm=intel
override CFLAGS+= -std=c11
override ASFLAGS+=
override LDFLAGS+=
override LDFLAGS+=
override INCLUDE+=
export CFLAGS
export ASFLAGS
export LDFLAGS
export INCLUDE
export DEPENFLAGS= -MMD -MP
.PHONY: $(TOPTARGETS)
all: $(BIN_DIRECTORY)
@:
$(BIN_DIRECTORY):
@mkdir -p $@
clean:
$(RM) -r $(BIN_DIRECTORY)
$(TOPTARGETS): $(SUBDIRS)
.PHONY: $(SUBDIRS)
$(SUBDIRS):
@echo "make --directory=$@ $(MAKECMDGOALS)"
@$(MAKE) --directory=$@ $(MAKECMDGOALS)