]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
fixed shadow issue
[xonotic/gmqcc.git] / Makefile
1 CC     ?= clang
2 CFLAGS += -Wall -I. -pedantic-errors -std=c90
3
4 #turn on tons of warnings if clang is present
5 ifeq ($(CC), clang)
6         CFLAGS += \
7                 -Weverything \
8                 -Wno-missing-prototypes \
9                 -Wno-unused-parameter \
10                 -Wno-sign-compare \
11                 -Wno-implicit-fallthrough \
12                 -Wno-sign-conversion \
13                 -Wno-conversion \
14                 -Wno-disabled-macro-expansion \
15                 -Wno-padded \
16                 -Wno-undef \
17                 -Wno-conditional-uninitialized \
18                 -Wno-missing-noreturn \
19                 -Wno-ignored-qualifiers \
20                 -Wno-unused-macros \
21                 -Wno-format-nonliteral
22
23 endif
24 OBJ     = lex.o       \
25           error.o     \
26           parse.o     \
27           typedef.o   \
28           util.o      \
29           code.o      \
30           asm.o       \
31           ast.o       \
32           ir.o 
33 OBJ_A = test/ast-test.o
34 OBJ_I = test/ir-test.o
35 OBJ_C = main.o
36
37 #default is compiler only
38 default: gmqcc
39 %.o: %.c
40         $(CC) -c $< -o $@ $(CFLAGS)
41
42 # test targets
43 test_ast: $(OBJ_A) $(OBJ)
44         $(CC) -o $@ $^ $(CFLAGS)
45 test_ir:  $(OBJ_I) $(OBJ)
46         $(CC) -o $@ $^ $(CFLAGS)
47 test: test_ast test_ir
48
49 # compiler target
50 gmqcc: $(OBJ_C) $(OBJ)
51         $(CC) -o $@ $^ $(CFLAGS)
52
53 #all target is test and all
54 all: test gmqcc
55
56 clean:
57         rm -f *.o gmqcc test_ast test_ir test/*.o
58         
59