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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,4 @@
-INSTALLDIR = /
-
-CC=gcc
-
-CFLAGS=-Wall -O2 ${shell $(CC) -Wno-pointer-sign -S -o /dev/null -x c - < /dev/null > /dev/null 2>&1 && echo "-Wno-pointer-sign"}
-
-export CC
-export CFLAGS
-export INSTALLDIR
+CFLAGS += -Wall ${shell $(CC) -Wno-pointer-sign -S -o /dev/null -x c - < /dev/null > /dev/null 2>&1 && echo "-Wno-pointer-sign"}
all:
$(MAKE) -C sbin/ all
--- a/kernel_test/Makefile
+++ b/kernel_test/Makefile
@@ -3,20 +3,18 @@ ALL_FILES = tomoyo_filesystem_test tomoyo_file_test tomoyo_rewrite_test newns to
all: $(ALL_FILES)
chmod 755 testall.sh
-CC=gcc
-
-CFLAGS=-Wall -O2 ${shell $(CC) -Wno-pointer-sign -S -o /dev/null -x c - < /dev/null > /dev/null 2>&1 && echo "-Wno-pointer-sign"}
+CFLAGS += -Wall ${shell $(CC) -Wno-pointer-sign -S -o /dev/null -x c - < /dev/null > /dev/null 2>&1 && echo "-Wno-pointer-sign"}
#
# Tools for kernel testing.
#
tomoyo_new_test: tomoyo_new_test.c include.h
- $(CC) $(CFLAGS) -o tomoyo_new_test tomoyo_new_test.c -lutil
+ $(CC) $(CFLAGS) $(LDFLAGS) -o tomoyo_new_test tomoyo_new_test.c -lutil
chmod 700 tomoyo_new_test
.c: include.h
- $(CC) $(CFLAGS) -o $@ $<
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
chmod 700 $@
#
--- a/sbin/Makefile
+++ b/sbin/Makefile
@@ -9,7 +9,7 @@ install: all
cp -af --remove-destination $(BUILD_FILES) $(INSTALLDIR)/sbin/
.c:
- $(CC) $(CFLAGS) -o $@ $<
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f -- $(BUILD_FILES)
--- a/usr_lib_tomoyo/Makefile
+++ b/usr_lib_tomoyo/Makefile
@@ -9,7 +9,7 @@ install: all
cp -af --remove-destination $(BUILD_FILES) tomoyotools.conf ../README.tomoyo ../COPYING.tomoyo $(INSTALLDIR)/usr/lib/tomoyo/
.c:
- $(CC) $(CFLAGS) -o $@ $<
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f -- $(BUILD_FILES)
--- a/usr_sbin/Makefile 2011-01-17 22:55:46.784698002 +0100
+++ b/usr_sbin/Makefile 2011-01-17 23:01:59.420137754 +0100
@@ -1,25 +1,29 @@
BUILD_FILES = tomoyo-domainmatch tomoyo-queryd tomoyo-pstree tomoyo-checkpolicy tomoyo-editpolicy tomoyo-findtemp tomoyo-ld-watch tomoyo-loadpolicy tomoyo-patternize tomoyo-savepolicy tomoyo-setlevel tomoyo-setprofile tomoyo-sortpolicy tomoyo-diffpolicy tomoyo-selectpolicy
+SIMPLE = tomoyo-domainmatch tomoyo-pstree tomoyo-checkpolicy tomoyo-findtemp tomoyo-ld-watch tomoyo-loadpolicy tomoyo-patternize tomoyo-savepolicy tomoyo-setlevel tomoyo-setprofile tomoyo-sortpolicy tomoyo-diffpolicy tomoyo-selectpolicy
all: libtomoyotools.so $(BUILD_FILES)
+$(SIMPLE): % : %.c libtomoyotools.so
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -ltomoyotools -L.
+
/usr/include/curses.h:
@echo "/usr/include/curses.h is missing."
@echo "Run 'yum install ncurses-devel' or 'apt-get install libncurses5-dev'"
sleep 10
-tomoyo-editpolicy: tomoyotools.h editpolicy*.c readline.h /usr/include/curses.h
- $(CC) $(CFLAGS) -o tomoyo-editpolicy editpolicy*.c -lncurses -ltomoyotools -L. -DCOLOR_ON || ln -f dummy tomoyo-editpolicy
+tomoyo-editpolicy: tomoyotools.h editpolicy*.c readline.h /usr/include/curses.h libtomoyotools.so
+ $(CC) $(CFLAGS) $(LDFLAGS) -o tomoyo-editpolicy editpolicy*.c -lncurses -ltomoyotools -L. -DCOLOR_ON
-tomoyo-queryd: tomoyotools.h tomoyo-queryd.c readline.h /usr/include/curses.h
- $(CC) $(CFLAGS) -o tomoyo-queryd tomoyo-queryd.c -lncurses -ltomoyotools -L. || ln -f dummy tomoyo-queryd
+tomoyo-queryd: tomoyotools.h tomoyo-queryd.c readline.h /usr/include/curses.h libtomoyotools.so
+ $(CC) $(CFLAGS) $(LDFLAGS) -o tomoyo-queryd tomoyo-queryd.c -lncurses -ltomoyotools -L.
libtomoyotools.so: tomoyotools.c tomoyotools.h
- $(CC) $(CFLAGS) -fPIC tomoyotools.c -shared -Wl,-soname,libtomoyotools.so.1 -o libtomoyotools.so.1.0.0
+ $(CC) $(CFLAGS) -fPIC $(LDFLAGS) tomoyotools.c -shared -Wl,-soname,libtomoyotools.so.1 -o libtomoyotools.so.1.0.0
ln -sf libtomoyotools.so.1.0.0 libtomoyotools.so
.c:
- $(CC) $(CFLAGS) -o $@ -ltomoyotools -L. $<
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -ltomoyotools -L. $<
install: all
mkdir -p $(INSTALLDIR)/usr/sbin $(INSTALLDIR)/usr/lib
cp -af --remove-destination $(BUILD_FILES) $(INSTALLDIR)/usr/sbin/
|