2012-04-25 14:20:38 +00:00
|
|
|
CC ?= clang
|
2012-08-22 09:49:46 +00:00
|
|
|
CFLAGS += -Wall -I. -pedantic-errors
|
2012-06-07 14:57:48 +00:00
|
|
|
|
|
|
|
#turn on tons of warnings if clang is present
|
|
|
|
ifeq ($(CC), clang)
|
2012-06-07 15:18:04 +00:00
|
|
|
CFLAGS += \
|
|
|
|
-Weverything \
|
|
|
|
-Wno-missing-prototypes \
|
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-sign-compare \
|
|
|
|
-Wno-implicit-fallthrough \
|
|
|
|
-Wno-sign-conversion \
|
|
|
|
-Wno-conversion \
|
2012-06-07 14:57:48 +00:00
|
|
|
-Wno-disabled-macro-expansion \
|
2012-06-07 15:18:04 +00:00
|
|
|
-Wno-padded \
|
2012-06-07 14:59:57 +00:00
|
|
|
-Wno-format-nonliteral
|
2012-06-07 14:57:48 +00:00
|
|
|
|
|
|
|
endif
|
2012-07-16 10:27:21 +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 \
|
|
|
|
error.o
|
2012-04-29 21:28:01 +00:00
|
|
|
OBJ_A = test/ast-test.o
|
|
|
|
OBJ_I = test/ir-test.o
|
2012-08-21 10:03:34 +00:00
|
|
|
OBJ_C = main.o lexer.o parser.o
|
2012-06-27 12:56:43 +00:00
|
|
|
OBJ_X = exec-standalone.o util.o
|
2012-04-09 10:42:06 +00:00
|
|
|
|
2012-04-29 20:54:05 +00:00
|
|
|
#default is compiler only
|
|
|
|
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-04-29 20:54:05 +00:00
|
|
|
# test targets
|
2012-04-29 21:28:01 +00:00
|
|
|
test_ast: $(OBJ_A) $(OBJ)
|
2012-05-03 20:54:34 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-04-29 21:28:01 +00:00
|
|
|
test_ir: $(OBJ_I) $(OBJ)
|
2012-04-29 20:54:05 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-06-25 21:58:47 +00:00
|
|
|
qcvm: $(OBJ_X)
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-06-27 20:04:02 +00:00
|
|
|
exec.o: execloop.h
|
|
|
|
exec-standalone.o: execloop.h
|
2012-04-29 20:54:05 +00:00
|
|
|
test: test_ast test_ir
|
|
|
|
|
2012-05-03 20:54:34 +00:00
|
|
|
# compiler target
|
2012-04-29 21:28:01 +00:00
|
|
|
gmqcc: $(OBJ_C) $(OBJ)
|
2012-04-09 10:42:06 +00:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-04-29 20:54:05 +00:00
|
|
|
|
|
|
|
#all target is test and all
|
|
|
|
all: test gmqcc
|
2012-05-03 20:54:34 +00:00
|
|
|
|
2012-04-09 10:42:06 +00:00
|
|
|
clean:
|
2012-06-27 13:36:22 +00:00
|
|
|
rm -f *.o gmqcc qcvm test_ast test_ir test/*.o
|
2012-06-07 14:57:48 +00:00
|
|
|
|
|
|
|
|