2012-11-17 10:00:32 +00:00
|
|
|
DESTDIR :=
|
|
|
|
PREFIX := /usr/local
|
|
|
|
BINDIR := $(PREFIX)/bin
|
|
|
|
|
2012-04-25 14:20:38 +00:00
|
|
|
CC ?= clang
|
2012-11-23 06:12:01 +00:00
|
|
|
CFLAGS += -Wall -Wextra -I. -pedantic-errors
|
2012-06-07 14:57:48 +00:00
|
|
|
#turn on tons of warnings if clang is present
|
|
|
|
ifeq ($(CC), clang)
|
2012-11-22 20:46:38 +00:00
|
|
|
CFLAGS += \
|
2012-06-07 15:18:04 +00:00
|
|
|
-Weverything \
|
|
|
|
-Wno-padded \
|
2012-11-22 20:46:38 +00:00
|
|
|
-Wno-format-nonliteral \
|
|
|
|
-Wno-disabled-macro-expansion \
|
2012-11-23 06:26:19 +00:00
|
|
|
-Wno-conversion \
|
|
|
|
-Wno-missing-prototypes
|
2012-06-07 14:57:48 +00:00
|
|
|
|
|
|
|
endif
|
2012-08-22 10:38:16 +00:00
|
|
|
ifeq ($(track), no)
|
|
|
|
CFLAGS += -DNOTRACK
|
|
|
|
endif
|
|
|
|
|
2012-11-17 10:00:55 +00:00
|
|
|
OBJ = \
|
2012-04-17 08:29:58 +00:00
|
|
|
util.o \
|
|
|
|
code.o \
|
2012-04-26 09:36:28 +00:00
|
|
|
ast.o \
|
2012-08-21 10:03:34 +00:00
|
|
|
ir.o \
|
2012-11-16 15:57:39 +00:00
|
|
|
con.o \
|
|
|
|
ftepp.o
|
2012-11-19 02:13:46 +00:00
|
|
|
|
2012-11-17 02:54:30 +00:00
|
|
|
OBJ_T = test.o util.o con.o
|
2012-08-21 10:03:34 +00:00
|
|
|
OBJ_C = main.o lexer.o parser.o
|
2012-11-14 20:39:16 +00:00
|
|
|
OBJ_X = exec-standalone.o util.o con.o
|
2012-04-09 10:42:06 +00:00
|
|
|
|
2012-11-17 10:00:55 +00:00
|
|
|
|
2012-04-29 20:54:05 +00:00
|
|
|
default: gmqcc
|
2012-04-09 10:42:06 +00:00
|
|
|
%.o: %.c
|
2012-04-10 01:32:24 +00:00
|
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
2012-04-09 10:42:06 +00:00
|
|
|
|
2012-06-27 12:56:43 +00:00
|
|
|
exec-standalone.o: exec.c
|
|
|
|
$(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
|
|
|
|
|
2012-11-17 02:54:30 +00:00
|
|
|
qcvm: $(OBJ_X)
|
2012-08-23 08:24:17 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS) -lm
|
2012-04-29 20:54:05 +00:00
|
|
|
|
2012-04-29 21:28:01 +00:00
|
|
|
gmqcc: $(OBJ_C) $(OBJ)
|
2012-11-10 20:53:37 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-04-29 20:54:05 +00:00
|
|
|
|
2012-11-21 20:31:41 +00:00
|
|
|
testsuite: $(OBJ_T)
|
2012-11-17 02:54:30 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
|
|
|
|
2012-11-21 20:31:41 +00:00
|
|
|
all: gmqcc qcvm testsuite
|
2012-05-03 20:54:34 +00:00
|
|
|
|
2012-11-21 20:31:41 +00:00
|
|
|
check: all
|
|
|
|
./testsuite
|
2012-11-21 20:27:41 +00:00
|
|
|
|
2012-04-09 10:42:06 +00:00
|
|
|
clean:
|
2012-11-21 20:31:41 +00:00
|
|
|
rm -f *.o gmqcc qcvm testsuite *.dat
|
2012-11-17 10:02:21 +00:00
|
|
|
|
2012-11-17 10:00:32 +00:00
|
|
|
|
2012-11-17 09:43:50 +00:00
|
|
|
$(OBJ) $(OBJ_C) $(OBJ_X): gmqcc.h
|
|
|
|
main.o: lexer.h
|
|
|
|
parser.o: ast.h lexer.h
|
|
|
|
ast.o: ast.h ir.h
|
|
|
|
ir.o: ir.h
|
2012-11-17 10:00:32 +00:00
|
|
|
|
|
|
|
install: install-gmqcc install-qcvm
|
|
|
|
install-gmqcc: gmqcc
|
|
|
|
install -d -m755 $(DESTDIR)$(BINDIR)
|
|
|
|
install -m755 gmqcc $(DESTDIR)$(BINDIR)/gmqcc
|
|
|
|
install-qcvm: qcvm
|
|
|
|
install -d -m755 $(DESTDIR)$(BINDIR)
|
|
|
|
install -m755 qcvm $(DESTDIR)$(BINDIR)/qcvm
|