-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
32 lines (20 loc) · 626 Bytes
/
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
OUTPUT_DIR := Debug
OUTPUT_FILE := ${OUTPUT_DIR}/munchlex
C_SRC := src/main.c src/parser.c src/threading.c src/tree.c src/flagger.c
C_OBJS := $(C_SRC:%.c=${OUTPUT_DIR}/%.o)
CCOMPILER := gcc
CFLAGS := -c -O2 -Wall -Werror -ggdb -c -I"./src/include" -pthread -fsanitize=thread
# compile
$(C_OBJS): $(OUTPUT_DIR)/%.o : %.c
@echo Compiling: $<
@mkdir -p $(@D)
@$(CCOMPILER) $(CFLAGS) -o "$@" "$<"
# link
all: clean $(OUTPUT_FILE)
$(OUTPUT_FILE) : $(C_OBJS)
@echo Linking: $@
@$(CCOMPILER) -o "$(OUTPUT_FILE)" $(C_OBJS) -pthread -fsanitize=thread
.PHONY: clean
clean:
@echo Cleaning Debug
@rm -rf $(OUTPUT_DIR)