forked from 8l/qbe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (40 loc) · 1.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
BIN = qbe
ABI = sysv
V = @
OBJDIR = obj
SRC = main.c util.c parse.c mem.c ssa.c copy.c fold.c live.c $(ABI).c isel.c spill.c rega.c emit.c
SRC += random.c
OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
$(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
@test -z "$(V)" || echo "ld $@"
$(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
$(OBJDIR)/%.o: %.c $(OBJDIR)/timestamp
@test -z "$(V)" || echo "cc $<"
$(V)$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/timestamp:
@mkdir -p $(OBJDIR)
@touch $@
$(OBJ): all.h
obj/main.o: config.h
config.h:
@case `uname` in \
*Darwin*) echo "#define Defaultasm Gasmacho" ;; \
*) echo "#define Defaultasm Gaself" ;; \
esac > $@
clean:
rm -fr $(OBJDIR)
clean-gen: clean
rm -f config.h
check: $(OBJDIR)/$(BIN)
tools/unit.sh all
80:
@for F in $(SRC); \
do \
awk "{ \
gsub(/\\t/, \" \"); \
if (length(\$$0) > $@) \
printf(\"$$F:%d: %s\\n\", NR, \$$0); \
}" < $$F; \
done
.PHONY: clean clean-gen check 80 syndoc