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