Lines 15-43
Link Here
|
15 |
CC = gcc |
15 |
CC = gcc |
16 |
LD = ld |
16 |
LD = ld |
17 |
CFLAGS = |
17 |
CFLAGS = |
18 |
OBJ_DEFINES = -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT |
18 |
ARCH_CFLAGS = |
|
|
19 |
OBJ_CFLAGS = -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT |
19 |
LIBS = |
20 |
LIBS = |
20 |
LDFLAGS = |
21 |
LDFLAGS = |
21 |
DESTDIR = |
22 |
DESTDIR = |
22 |
|
23 |
|
23 |
TARGETS = libsandbox.so sandbox |
24 |
HAVE_64BIT_ARCH = |
|
|
25 |
|
26 |
ifneq ($(HAVE_64BIT_ARCH),) |
27 |
TARGETS = libsandbox.so libsandbox32.so sandbox |
28 |
ARCH_CFLAGS += -m64 |
29 |
OBJ_CFLAGS += -DSB_HAVE_64BIT_ARCH |
30 |
else |
31 |
TARGETS = libsandbox.so sandbox |
32 |
endif |
24 |
|
33 |
|
25 |
all: $(TARGETS) |
34 |
all: $(TARGETS) |
26 |
|
35 |
|
27 |
sandbox: sandbox.o sandbox_futils.o getcwd.c |
36 |
sandbox: sandbox.o sandbox_futils.o getcwd.c |
28 |
$(CC) $^ -ldl -lc -o $@ |
37 |
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(OBJ_CFLAGS) -Wall $^ -ldl -lc -o $@ |
29 |
|
38 |
|
30 |
sandbox.o: sandbox.c sandbox.h |
39 |
sandbox.o: sandbox.c sandbox.h |
31 |
$(CC) $(CFLAGS) -Wall -c sandbox.c |
40 |
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(OBJ_CFLAGS) -Wall -c sandbox.c -o $@ |
32 |
|
41 |
|
33 |
sandbox_futils.o: sandbox_futils.c sandbox.h |
42 |
sandbox_futils.o: sandbox_futils.c sandbox.h |
34 |
$(CC) $(CFLAGS) -Wall -c $(OBJ_DEFINES) sandbox_futils.c |
43 |
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(OBJ_CFLAGS) -Wall -c sandbox_futils.c -o $@ |
35 |
|
44 |
|
36 |
libsandbox.so: libsandbox.o sandbox_futils.o |
45 |
libsandbox.so: libsandbox.o sandbox_futils.o |
37 |
$(CC) $^ -shared -fPIC -ldl -lc -o $@ -nostdlib -lgcc |
46 |
$(CC) $^ -shared $(ARCH_CFLAGS) -fPIC -ldl -lc -nostdlib -lgcc -o $@ |
38 |
|
47 |
|
39 |
libsandbox.o: libsandbox.c localdecls.h canonicalize.c getcwd.c |
48 |
libsandbox.o: libsandbox.c localdecls.h canonicalize.c getcwd.c |
40 |
$(CC) $(CFLAGS) -Wall -c $(OBJ_DEFINES) libsandbox.c |
49 |
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(OBJ_CFLAGS) -Wall -c libsandbox.c |
|
|
50 |
|
51 |
sandbox_futils32.o: sandbox_futils.c sandbox.h |
52 |
$(CC) $(CFLAGS) -m32 $(OBJ_CFLAGS) -Wall -c sandbox_futils.c -o $@ |
53 |
|
54 |
libsandbox32.so: libsandbox32.o sandbox_futils32.o |
55 |
$(CC) $^ -shared -m32 -fPIC -ldl -lc -nostdlib -lgcc -o $@ |
56 |
|
57 |
libsandbox32.o: libsandbox.c localdecls.h canonicalize.c getcwd.c |
58 |
$(CC) $(CFLAGS) -m32 $(OBJ_CFLAGS) -Wall -c libsandbox.c -o $@ |
41 |
|
59 |
|
42 |
localdecls.h: create-localdecls libctest.c |
60 |
localdecls.h: create-localdecls libctest.c |
43 |
./create-localdecls |
61 |
./create-localdecls |
Lines 45-53
Link Here
|
45 |
|
63 |
|
46 |
install: all |
64 |
install: all |
47 |
install -d -m 0755 $(DESTDIR)/lib |
65 |
install -d -m 0755 $(DESTDIR)/lib |
|
|
66 |
$(if $(HAVE_64BIT_ARCH),install -d -m 0755 $(DESTDIR)/lib32) |
48 |
install -d -m 0755 $(DESTDIR)/usr/lib/portage/bin |
67 |
install -d -m 0755 $(DESTDIR)/usr/lib/portage/bin |
49 |
install -d -m 0755 $(DESTDIR)/usr/lib/portage/lib |
68 |
install -d -m 0755 $(DESTDIR)/usr/lib/portage/lib |
50 |
install -m 0755 libsandbox.so $(DESTDIR)/lib |
69 |
install -m 0755 libsandbox.so $(DESTDIR)/lib |
|
|
70 |
$(if $(HAVE_64BIT_ARCH),install -m 0755 libsandbox32.so $(DESTDIR)/lib32/libsandbox.so) |
51 |
install -m 0755 sandbox $(DESTDIR)/usr/lib/portage/bin |
71 |
install -m 0755 sandbox $(DESTDIR)/usr/lib/portage/bin |
52 |
install -m 0644 sandbox.bashrc $(DESTDIR)/usr/lib/portage/lib |
72 |
install -m 0644 sandbox.bashrc $(DESTDIR)/usr/lib/portage/lib |
53 |
|
73 |
|