-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
88 lines (57 loc) · 1.89 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
PKG=glib-2.0
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
LLVM_CONFIG=llvm-config-11
LLVM_BITS=all
LIBIDL_CFLAGS=-I libIDL/include
LIBIDL_LIBS=libIDL/.libs/libIDL-2.a
CCAN_DIR=~/src/ccan
CCAN_BITS=hash htable str strset strmap ilog talloc
CFLAGS:=-std=gnu11 -Wall -g -O2 -pthread -I include -I $(CCAN_DIR) \
$(LIBIDL_CFLAGS) -Wno-sign-compare -Wimplicit-fallthrough=2 \
$(shell pkg-config --cflags $(PKG)) \
$(shell $(LLVM_CONFIG) --cflags | ./remove-unwanted-opts.pl)
LDFLAGS:=-Wl,--as-needed $(shell $(LLVM_CONFIG) --ldflags)
LIBS:=$(shell pkg-config --libs $(PKG)) \
$(shell $(LLVM_CONFIG) --libs --system-libs $(LLVM_BITS)) -lm -ldl
.PHONY: all clean distclean
all: tags
+@make $(LIBIDL_LIBS)
+@make muidl
clean:
@rm -f *.o
+@make output-clean
output-clean:
@rm -f *-defs.h *-service.s *-client.s *-common.s
distclean: clean
@rm -f muidl
+@make -C libIDL distclean
@rm -f tags
@rm -rf .deps
check: muidl
t/run_all.pl
+@make output-clean
muidl: muidl.o util.o analyse.o verify.o llvmutil.o attr.o l4x2.o \
message.o sequence.o types.o struct.o header.o common.o \
dispatch.o stub.o except.o iface.o op.o signature.o \
stringfn.o $(CCAN_BITS:%=ccan-%.o)
@echo " LD $@"
@$(CXX) -o $@ $^ $(LIBIDL_LIBS) $(CFLAGS) $(LDFLAGS) $(LIBS)
libIDL/.libs/libIDL-2.a libIDL/include/libIDL/IDL.h:
@cd libIDL; ./autogen.sh
+@make -C libIDL
tags: $(shell find . -iname \*.[ch] -print) $(shell find . -iname \*.p[ml] -print)
@ctags --exclude=Makefile\* --exclude=configure\* \
--exclude=libtool\* --exclude=\*.in --exclude=\*.m4 \
-R .
.deps:
@mkdir -p .deps
%.o: %.c libIDL/include/libIDL/IDL.h
@echo " CC $@"
@$(CC) -c -o $@ $< -MMD $(CFLAGS)
@test -d .deps || mkdir -p .deps
@mv $(<:.c=.d) .deps/
ccan-%.o ::
@echo " CC $@ <ccan>"
@$(CC) -c -o $@ $(CCAN_DIR)/ccan/$*/$*.c $(CFLAGS)
ccan-hash.o :: CFLAGS += -Wno-implicit-fallthrough
include $(wildcard .deps/*.d)