build.mk 1.17 KB
Newer Older
1
2
3
4
5
6
7
8
# Some make rules to make output pretty....

# default ARFLAGS also has 'v', but we don't want it to be verbose.
ARFLAGS= -r

# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib

Jeroen Vreeken's avatar
Jeroen Vreeken committed
9
10
LIBTOOL=libtool

11
%.o : %.c
12
13
14
15
16
	@echo "LT   CC $<"
	@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MD $(CFLAGS) -c $<

#	@echo "     CC $<"
#	@$(CC) -MD $(CFLAGS) -c $<
17
18

%: %.o
Jeroen Vreeken's avatar
Jeroen Vreeken committed
19
	@echo "     LD $@"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
20
	@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $(filter %.o,$^) $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
21

Jeroen Vreeken's avatar
Jeroen Vreeken committed
22
23
24
%.lo: %.c
	@echo "LT   CC $<"
	@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MD $(CFLAGS) -c $<
25

Jeroen Vreeken's avatar
Jeroen Vreeken committed
26
27
28
29
30
31
32
%.la:
	@echo "LIBTOOL $@"
	@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs

(%): %
	@echo "   AR  $^ in $@"
	@$(AR) $(ARFLAGS) $@ $^
33

34
%.tab.c %.tab.h: %.y
Jeroen Vreeken's avatar
Jeroen Vreeken committed
35
	@echo "BISON   $<"
36
37
	@bison -d $<

Jeroen Vreeken's avatar
Jeroen Vreeken committed
38
39
40
41
%.yy.h: %.l %.tab.h
	@echo " FLEX   $<"
	@flex --header-file=$*.yy.h $<

42
%.yy.c: %.l %.tab.h
Jeroen Vreeken's avatar
Jeroen Vreeken committed
43
	@echo " FLEX   $<"
44
45
46
47
48
49
50
51
52
53
54
55
56
	@flex -o $@ $<

# il2c: instruction list 2 c 'compiler'
%.c %.h: %.il
	@echo " IL2C  $<"
	@$(IL2C) $<

# dot -> pdf
%.pdf: %.dot
	@echo "  DOT  $<"
	@dot $< -o $@ -Tpdf

-include $(SRCS:.c=.d)