]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
More compile warnings (disabled many for now, they will be re-enabled one-by-one...
[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                 -Wno-shadow
23
24 endif
25 OBJ     = lex.o       \
26           error.o     \
27           parse.o     \
28           typedef.o   \
29           util.o      \
30           code.o      \
31           asm.o       \
32           ast.o       \
33           ir.o 
34 OBJ_A = test/ast-test.o
35 OBJ_I = test/ir-test.o
36 OBJ_C = main.o
37
38 #default is compiler only
39 default: gmqcc
40 %.o: %.c
41         $(CC) -c $< -o $@ $(CFLAGS)
42
43 # test targets
44 test_ast: $(OBJ_A) $(OBJ)
45         $(CC) -o $@ $^ $(CFLAGS)
46 test_ir:  $(OBJ_I) $(OBJ)
47         $(CC) -o $@ $^ $(CFLAGS)
48 test: test_ast test_ir
49
50 # compiler target
51 gmqcc: $(OBJ_C) $(OBJ)
52         $(CC) -o $@ $^ $(CFLAGS)
53
54 #all target is test and all
55 all: test gmqcc
56
57 clean:
58         rm -f *.o gmqcc test_ast test_ir test/*.o
59         
60