gmqcc/Makefile

52 lines
1 KiB
Makefile
Raw Normal View History

2012-04-25 14:20:38 +00:00
CC ?= clang
CFLAGS += -Wall -I. -pedantic-errors -std=c90
#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 \
-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
endif
OBJ = \
error.o \
util.o \
code.o \
ast.o \
ir.o
2012-04-29 21:28:01 +00:00
OBJ_A = test/ast-test.o
OBJ_I = test/ir-test.o
OBJ_C = main.o
2012-04-09 10:42:06 +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
# test targets
2012-04-29 21:28:01 +00:00
test_ast: $(OBJ_A) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
2012-04-29 21:28:01 +00:00
test_ir: $(OBJ_I) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
test: test_ast test_ir
# 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)
#all target is test and all
all: test gmqcc
2012-04-09 10:42:06 +00:00
clean:
rm -f *.o gmqcc test_ast test_ir test/*.o