-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (41 loc) · 1.1 KB
/
Makefile
File metadata and controls
55 lines (41 loc) · 1.1 KB
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
54
55
.POSIX:
.SUFFIXES:
.SUFFIXES: .c .o
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
COMMON_OBJ = main.o ir.o parse.o util.o dephi.o
X64_OBJ = isel_naive.o ra_naive.o isel.o ra.o
OBJ = $(COMMON_OBJ) $(X64_OBJ)
SRCALL = $(OBJ:.o=.c)
CC = cc
CFLAGS = -std=c89 -g -Wall -Wextra -Wpedantic
LDFLAGS =
-include config.mk
wqbe: $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
$(OBJ): all.h tree.h instr.inc
$(X64_OBJ): x64.h x64.inc
clean:
rm -f *.o wqbe
fmt:
@for F in $(SRCALL); \
do \
awk "{ \
if (\$$0 ~ /\\t/) \
printf(\"$$F:%d contains tab: %s\\n\", NR, \$$0); \
if (\$$0 ~ / +\$$/) \
printf(\"$$F:%d line has trailing space: %s\\n\", NR, \$$0); \
if (length(\$$0) > 80) \
printf(\"$$F:%d line too long: %s\\n\", NR, \$$0); \
}" < $$F; \
done
check: wqbe
qbe/tools/test.sh all
install: wqbe
mkdir -p "$(DESTDIR)$(BINDIR)"
install -m755 wqbe "$(DESTDIR)$(BINDIR)/wqbe"
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/wqbe"
.PHONY: clean fmt check