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