]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
Removed even more warnings
[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-format-nonliteral
19
20 endif
21 OBJ     = lex.o       \
22           error.o     \
23           parse.o     \
24           typedef.o   \
25           util.o      \
26           code.o      \
27           asm.o       \
28           ast.o       \
29           ir.o 
30 OBJ_A = test/ast-test.o
31 OBJ_I = test/ir-test.o
32 OBJ_C = main.o
33
34 #default is compiler only
35 default: gmqcc
36 %.o: %.c
37         $(CC) -c $< -o $@ $(CFLAGS)
38
39 # test targets
40 test_ast: $(OBJ_A) $(OBJ)
41         $(CC) -o $@ $^ $(CFLAGS)
42 test_ir:  $(OBJ_I) $(OBJ)
43         $(CC) -o $@ $^ $(CFLAGS)
44 test: test_ast test_ir
45
46 # compiler target
47 gmqcc: $(OBJ_C) $(OBJ)
48         $(CC) -o $@ $^ $(CFLAGS)
49
50 #all target is test and all
51 all: test gmqcc
52
53 clean:
54         rm -f *.o gmqcc test_ast test_ir test/*.o
55         
56