Fixing some indentation
[xonotic/gmqcc.git] / Makefile
1 DESTDIR :=
2 PREFIX := /usr/local
3 BINDIR := $(PREFIX)/bin
4
5 CC     ?= clang
6 CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector -fno-common
7 #turn on tons of warnings if clang is present
8 ifeq ($(CC), clang)
9         CFLAGS +=                  \
10                 -Weverything                  \
11                 -Wno-missing-prototypes       \
12                 -Wno-unused-parameter         \
13                 -Wno-sign-compare             \
14                 -Wno-implicit-fallthrough     \
15                 -Wno-sign-conversion          \
16                 -Wno-conversion               \
17                 -Wno-disabled-macro-expansion \
18                 -Wno-padded                   \
19                 -Wno-format-nonliteral
20
21 endif
22 ifeq ($(track), no)
23     CFLAGS += -DNOTRACK
24 endif
25
26 OBJ     = \
27           util.o      \
28           code.o      \
29           ast.o       \
30           ir.o        \
31           con.o       \
32           ftepp.o
33 OBJ_C = main.o lexer.o parser.o
34 OBJ_X = exec-standalone.o util.o con.o
35
36 #default is compiler only
37 default: gmqcc
38 %.o: %.c
39         $(CC) -c $< -o $@ $(CFLAGS)
40
41 exec-standalone.o: exec.c
42         $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
43
44 qcvm:     $(OBJ_X)
45         $(CC) -o $@ $^ $(CFLAGS) -lm
46
47 # compiler target
48 gmqcc: $(OBJ_C) $(OBJ)
49         $(CC) -o $@ $^ $(CFLAGS)
50
51 all: gmqcc qcvm
52
53 clean:
54         rm -f *.o gmqcc qcvm
55
56 $(OBJ) $(OBJ_C) $(OBJ_X): gmqcc.h
57 main.o: lexer.h
58 parser.o: ast.h lexer.h
59 ast.o: ast.h ir.h
60 ir.o: ir.h
61
62 install: install-gmqcc install-qcvm
63 install-gmqcc: gmqcc
64         install -d -m755          $(DESTDIR)$(BINDIR)
65         install    -m755  gmqcc   $(DESTDIR)$(BINDIR)/gmqcc
66 install-qcvm: qcvm
67         install -d -m755          $(DESTDIR)$(BINDIR)
68         install    -m755  qcvm    $(DESTDIR)$(BINDIR)/qcvm