build.mk 1.11 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
11
%.o : %.c
Jeroen Vreeken's avatar
Jeroen Vreeken committed
12
	@echo "     CC $<"
13
	@$(CC) -MMD $(CFLAGS) $($@_CFLAGS) -c $<
Jeroen Vreeken's avatar
Jeroen Vreeken committed
14
15

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

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

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

(%): %
Jeroen Vreeken's avatar
Jeroen Vreeken committed
28
	@echo "     AR $^ in $@"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
29
	@$(AR) $(ARFLAGS) $@ $^
Jeroen Vreeken's avatar
Jeroen Vreeken committed
30
31

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

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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
39
%.yy.c: %.l %.tab.h
Jeroen Vreeken's avatar
Jeroen Vreeken committed
40
	@echo " FLEX   $<"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
41
42
43
44
45
46
47
48
49
50
51
52
53
	@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)