-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (24 loc) · 775 Bytes
/
Makefile
File metadata and controls
38 lines (24 loc) · 775 Bytes
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
SRC_DIR=./src/
OUTPUT=main
##################################
## Compiler and linker ##
##################################
SANITIZER_FLAG=
#-fsanitize-address-use-after-scope -fsanitize=address -fsanitize=undefined
CFLAGS=-g -I./include -O0 -fPIE -fPIC -xc -nostdlib++ -fblocks $(SANITIZER_FLAG) -I$(SRC_DIR) -I/usr/include/SDL2/ -O0
LFLAGS=-g -fPIE -fPIC -rdynamic -lBlocksRuntime $(SANITIZER_FLAG) -L./libs -lSDL2 -lpthread -lm
#-static-libsan
C_COMPILER=clang
LINKER=clang
##################################
SRCS=$(shell find $(SRC_DIR) -regex .+[.]c)
OBJS=$(SRCS:.c=.o)
.PHONY: all
all: $(OBJS)
$(MAKE) link
$(OBJS): %.o: %.c
$(C_COMPILER) $(CFLAGS) -c -o $@ $<
link:
$(LINKER) $(OBJS) $(LFLAGS) -o $(OUTPUT)
clean:
rm $(OBJS) $(OUTPUT)