3 UNAME ?= $(shell uname)
4 CYGWIN = $(findstring CYGWIN, $(UNAME))
5 MINGW = $(findstring MINGW, $(UNAME))
7 # turn on tons of warnings if clang is present
8 # but also turn off the STUPID ONES
13 -Wno-format-nonliteral \
14 -Wno-disabled-macro-expansion \
17 -Wno-unknown-warning-option \
25 CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
29 CFLAGS += -pedantic-errors
31 CFLAGS += -Wno-pointer-sign -fno-common
35 ifneq ($(shell git describe --always 2>/dev/null),)
36 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
39 ifeq ($(shell valgrind --version 2>/dev/null),)
43 # do this last otherwise there is whitespace in the command output and
44 # it makes my OCD act up
45 CFLAGS += $(OPTIONAL_CFLAGS)
46 LDFLAGS += $(OPTIONAL_LDFLAGS)
48 #we have duplicate object files when dealing with creating a simple list
49 #for dependinces. To combat this we use some clever recrusive-make to
50 #filter the list and remove duplicates which we use for make depend
51 RMDUP = $(if $1,$(firstword $1) $(call RMDUP,$(filter-out $(firstword $1),$1)))
52 DEPS := $(call RMDUP, $(OBJ_P) $(OBJ_T) $(OBJ_C) $(OBJ_X))
54 ifneq ("$(CYGWIN)", "")
55 #nullify the common variables that
56 #most *nix systems have (for windows)
63 TESTSUITE = testsuite.exe
66 ifneq ("$(MINGW)", "")
67 #nullify the common variables that
68 #most *nix systems have (for windows)
75 TESTSUITE = testsuite.exe
86 $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
89 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
91 $(GMQCC): $(OBJ_C) $(OBJ_D)
92 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
94 $(TESTSUITE): $(OBJ_T)
95 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
97 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
104 strip: $(GMQCC) $(QCVM) $(TESTSUITE)
110 rm -rf *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe gm-qcc.tgz ./cov-int
113 @ makedepend -Y -w 65536 2> /dev/null $(subst .o,.c,$(DEPS))
117 @cov-build --dir cov-int $(MAKE)
118 @tar czf gm-qcc.tgz cov-int
120 @echo gm-qcc.tgz generated, submit for analysis
123 install: install-gmqcc install-qcvm install-gmqpak install-doc
124 install-gmqcc: $(GMQCC)
125 install -d -m755 $(DESTDIR)$(BINDIR)
126 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
127 install-qcvm: $(QCVM)
128 install -d -m755 $(DESTDIR)$(BINDIR)
129 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
131 install -d -m755 $(DESTDIR)$(MANDIR)/man1
132 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
133 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
134 install -m644 doc/gmqpak.1 $(DESTDIR)$(MANDIR)/man1/
138 ansi.o: platform.h gmqcc.h opts.def
139 util.o: gmqcc.h opts.def platform.h
140 hash.o: gmqcc.h opts.def
141 stat.o: gmqcc.h opts.def
142 fs.o: gmqcc.h opts.def platform.h
143 opts.o: gmqcc.h opts.def
144 conout.o: gmqcc.h opts.def
145 test.o: gmqcc.h opts.def platform.h
146 main.o: gmqcc.h opts.def lexer.h
147 lexer.o: gmqcc.h opts.def lexer.h
148 parser.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
149 code.o: gmqcc.h opts.def
150 ast.o: gmqcc.h opts.def ast.h ir.h parser.h lexer.h
151 ir.o: gmqcc.h opts.def ir.h
152 ftepp.o: gmqcc.h opts.def lexer.h
153 utf8.o: gmqcc.h opts.def
154 correct.o: gmqcc.h opts.def
155 fold.o: ast.h ir.h gmqcc.h opts.def parser.h lexer.h
156 intrin.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
157 exec.o: gmqcc.h opts.def