3 BINDIR := $(PREFIX)/bin
4 DATADIR := $(PREFIX)/share
5 MANDIR := $(DATADIR)/man
7 UNAME ?= $(shell uname)
8 CYGWIN = $(findstring CYGWIN, $(UNAME))
9 MINGW = $(findstring MINGW32, $(UNAME))
12 CFLAGS += -Wall -Wextra -I. -fno-strict-aliasing -fsigned-char
13 ifneq ($(shell git describe --always 2>/dev/null),)
14 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
16 #turn on tons of warnings if clang is present
17 # but also turn off the STUPID ONES
22 -Wno-format-nonliteral \
23 -Wno-disabled-macro-expansion \
25 -Wno-missing-prototypes \
29 #Tiny C Compiler doesn't know what -pedantic-errors is
30 # and instead of ignoring .. just errors.
32 CFLAGS +=-pedantic-errors
34 CFLAGS += -Wno-pointer-sign -fno-common
42 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o correct.o
43 OBJ_T = test.o util.o conout.o file.o
44 OBJ_C = main.o lexer.o parser.o file.o
45 OBJ_X = exec-standalone.o util.o conout.o file.o
47 ifneq ("$(CYGWIN)", "")
48 #nullify the common variables that
49 #most *nix systems have (for windows)
56 TESTSUITE = testsuite.exe
58 ifneq ("$(MINGW)", "")
59 #nullify the common variables that
60 #most *nix systems have (for windows)
67 TESTSUITE = testsuite.exe
69 #arm support for linux .. we need to allow unaligned accesses
70 #to memory otherwise we just segfault everywhere
71 ifneq (, $(findstring arm, $(shell uname -m)))
72 CFLAGS += -munaligned-access
111 -shiftimplementation \
116 -bufferoverflowhigh \
135 $(CC) -c $< -o $@ $(CFLAGS)
137 exec-standalone.o: exec.c
138 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
141 $(CC) -o $@ $^ $(CFLAGS) -lm
143 $(GMQCC): $(OBJ_C) $(OBJ_D)
144 $(CC) -o $@ $^ $(CFLAGS)
146 $(TESTSUITE): $(OBJ_T)
147 $(CC) -o $@ $^ $(CFLAGS)
149 all: $(GMQCC) $(QCVM) $(TESTSUITE)
154 # alias to check because test.o exists and people will get confused
155 # about the undefined references to X.
159 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
162 @ splint $(SPLINTFLAGS) *.c *.h
165 @makedepend -Y -w 65536 2> /dev/null \
166 $(subst .o,.c,$(OBJ_D))
167 @makedepend -a -Y -w 65536 2> /dev/null \
168 $(subst .o,.c,$(OBJ_T))
169 @makedepend -a -Y -w 65536 2> /dev/null \
170 $(subst .o,.c,$(OBJ_C))
171 @makedepend -a -Y -w 65536 2> /dev/null \
172 $(subst .o,.c,$(OBJ_X))
175 install: install-gmqcc install-qcvm install-doc
176 install-gmqcc: $(GMQCC)
177 install -d -m755 $(DESTDIR)$(BINDIR)
178 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
179 install-qcvm: $(QCVM)
180 install -d -m755 $(DESTDIR)$(BINDIR)
181 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
183 install -d -m755 $(DESTDIR)$(MANDIR)/man1
184 install -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
185 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
189 util.o: gmqcc.h opts.def
190 code.o: gmqcc.h opts.def
191 ast.o: gmqcc.h opts.def ast.h ir.h
192 ir.o: gmqcc.h opts.def ir.h
193 conout.o: gmqcc.h opts.def
194 ftepp.o: gmqcc.h opts.def lexer.h
195 opts.o: gmqcc.h opts.def
196 file.o: gmqcc.h opts.def
197 utf8.o: gmqcc.h opts.def
198 correct.o: gmqcc.h opts.def
200 test.o: gmqcc.h opts.def
201 util.o: gmqcc.h opts.def
202 conout.o: gmqcc.h opts.def
203 file.o: gmqcc.h opts.def
205 main.o: gmqcc.h opts.def lexer.h
206 lexer.o: gmqcc.h opts.def lexer.h
207 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h
208 file.o: gmqcc.h opts.def
210 util.o: gmqcc.h opts.def
211 conout.o: gmqcc.h opts.def
212 file.o: gmqcc.h opts.def