Changeset 20
- Timestamp:
- 04/16/08 15:52:23 (8 months ago)
- Files:
-
- trunk/libsipc.spec (added)
- trunk/libsipc/Makefile (modified) (2 diffs)
- trunk/libsipc/bindings/java/Makefile (modified) (1 diff)
- trunk/libsipc/bindings/java/README (modified) (1 diff)
- trunk/libsipc/bindings/java/sipc_java_wrapper (deleted)
- trunk/libsipc/bindings/java/sipc_wrap.c (copied) (copied from trunk/libsipc/bindings/java/sipc_java_wrapper/sipc_wrap.c)
- trunk/libsipc/examples/Makefile (modified) (2 diffs)
- trunk/libsipc/examples/policy/Makefile (modified) (7 diffs)
- trunk/libsipc/include/Makefile (modified) (1 diff)
- trunk/libsipc/man/Makefile (modified) (1 diff)
- trunk/libsipc/src/Makefile (modified) (1 diff)
- trunk/libsipc/tests/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libsipc/Makefile
r3 r20 1 # Subdirectories which contain targets2 SUBDIRS=src tests examples bindings/java3 4 1 # Installation directories 5 export PREFIX ?= $(DESTDIR)/usr 6 export LIBDIR ?= $(PREFIX)/lib 7 export SHLIBDIR ?= $(DESTDIR)/lib 8 export MANDIR ?= $(DESTDIR)/usr/share/man/man3 9 export EXAMPLESDIR ?= $(DESTDIR)/usr/share/sipc 10 11 export CFLAGS ?= -O3 -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE 12 override CFLAGS += -L../src -I../include 2 PREFIX ?= $(DESTDIR)/usr/local 3 INCLUDEDIR ?= $(PREFIX)/include 4 LIBDIR ?= $(PREFIX)/lib 5 DATAROOTDIR ?= $(PREFIX)/share 6 MANDIR ?= $(DATAROOTDIR)/man 13 7 14 8 ifeq ($(DEBUG), 1) 15 export CFLAGS += -g3 -gdwarf-2 9 CFLAGS ?= -O0 -g3 -gdwarf-2 10 LDFLAGS ?= -g 11 else 12 CFLAGS ?= -O3 16 13 endif 17 14 18 all: $(SUBDIRS) 19 for i in $? ; do \ 20 ($(MAKE) -C $$i);\ 15 override CFLAGS += -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE -fpic 16 INCLUDEDIRS := -I$(shell pwd)/include 17 LIBDIRS := -L$(shell pwd)/src 18 19 export PREFIX INCLUDEDIR LIBDIR DATAROOTDIR MANDIR \ 20 CFLAGS LDFLAGS INCLUDEDIRS LIBDIRS 21 22 # Subdirectories which contain targets 23 SUBDIRS = src include bindings/java examples man tests 24 25 all: 26 for i in $(SUBDIRS) ; do \ 27 ($(MAKE) -C $$i all) || exit 1;\ 21 28 done 22 29 23 30 example: 24 $(MAKE) -C examples 31 $(MAKE) -C examples $@ 25 32 26 33 test: 27 $(MAKE) -C tests 34 $(MAKE) -C tests $@ 28 35 29 binding: install-bindings 36 binding: 37 $(MAKE) -C bindings/java $@ 30 38 31 39 install: 32 $(MAKE) -C src install 33 $(MAKE) -C include install 34 $(MAKE) -C man install 35 $(MAKE) -C examples install 36 # $(MAKE) -C bindings install 40 for i in $(SUBDIRS) ; do \ 41 ($(MAKE) -C $$i install) || exit 1;\ 42 done 37 43 38 install- policy:39 $(MAKE) -C examples /policy$@44 install-example: 45 $(MAKE) -C examples $@ 40 46 41 install-binding s:42 $(MAKE) -C bindings 47 install-binding: 48 $(MAKE) -C bindings/java $@ 43 49 44 50 javadoc: … … 46 52 47 53 clean: 48 $(MAKE) -C src clean 49 $(MAKE) -C examples clean 50 $(MAKE) -C tests clean 54 for i in $(SUBDIRS) ; do \ 55 ($(MAKE) -C $$i clean);\ 56 done 57 58 .phony: all example test binding install install-policy javadoc clean trunk/libsipc/bindings/java/Makefile
r3 r20 1 INSTDIR=$(EXAMPLESDIR)/bindings/java 1 BINDINGSDIR = $(DATAROOTDIR)/sipc/bindings/java 2 JARDIR = $(DATAROOTDIR)/java 2 3 3 all: install 4 SRC = com/tresys/sipc/BadKeyException.java \ 5 com/tresys/sipc/ConnectionException.java \ 6 com/tresys/sipc/libsipc.java \ 7 com/tresys/sipc/Sipc.java \ 8 com/tresys/sipc/SipcMqueue.java \ 9 com/tresys/sipc/SipcShm.java 10 11 CLASSES = $(patsubst %.java,%.class,$(SRC)) 12 JAVAC ?= javac 13 JAR ?= jar 14 15 # Change the following values to be appropriate for your system: 16 # 17 # JNI_CFLAGS: Location of JNI include files. 18 # Only set this value if JNI's include files 19 # are installed outside of the compiler's search path. 20 21 #JNI_CFLAGS=-I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux 22 JNI_CFLAGS=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fno-strict-aliasing 23 24 LIBVERSION = 0.1 25 TARGET = libsipcwrapper.so 26 LIBSO = $(TARGET).$(LIBVERSION) 27 OBJS = sipc_wrap.o 28 29 all: 30 31 binding: libsipc.jar $(LIBSO) 32 33 install-binding: 34 test -d $(BINDINGSDIR) || install -m 755 -d $(BINDINGSDIR) 35 test -d $(BINDINGSDIR)/examples || install -m 755 -d $(BINDINGSDIR)/examples 36 install -m 644 README $(BINDINGSDIR) 37 install -m 644 examples/* $(BINDINGSDIR)/examples 38 install -m 644 libsipc.jar $(BINDINGSDIR) 39 test -d $(JARDIR) || install -m 755 -d $(JARDIR) 40 cd $(JARDIR) && ln -sf $(BINDINGSDIR)/libsipc.jar libsipc.jar 41 test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) 42 install -m 755 $(LIBSO) $(LIBDIR) 43 cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 44 45 libsipc.jar: $(CLASSES) 46 $(JAR) cf libsipc.jar $(CLASSES) 47 48 %.class: %.java 49 $(JAVAC) $(JFLAGS) $< 50 51 $(LIBSO): $(OBJS) 52 $(CC) $(LDFLAGS) $(LIBDIRS) -lsipc -shared -o $@ $< 53 ln -sf $@ $(TARGET) 54 55 %.o: %.c 56 $(CC) $(CFLAGS) $(INCLUDEDIRS) $(JNI_CFLAGS) -c -o $@ $< 57 4 58 install: 5 test -d $(EXAMPLESDIR)/bindings || install -m 755 -d $(EXAMPLESDIR)/bindings6 test -d $(INSTDIR) || install -m 755 -d $(INSTDIR)7 test -d $(INSTDIR)/sipc_java_wrapper || install -m 755 -d $(INSTDIR)/sipc_java_wrapper8 test -d $(INSTDIR)/examples || install -m 755 -d $(INSTDIR)/examples9 install -m 644 README $(INSTDIR)10 install -m 644 examples/* $(INSTDIR)/examples11 install -m 644 sipc_java_wrapper/* $(INSTDIR)/sipc_java_wrapper12 cp -a com $(INSTDIR)13 59 14 60 javadoc: 15 61 javadoc -d javadoc com.tresys.sipc 62 63 clean: 64 -rm -f $(CLASSES) libsipc.jar $(TARGET) $(LIBSO) $(OBJS) 65 66 .phony: all install clean javadoc trunk/libsipc/bindings/java/README
r1 r20 2 2 ============ 3 3 4 This directory contains Java bindings to libsipc and example applications using these bindings. 5 To install the bindings, a few settings need to be adjusted. 4 This directory contains Java bindings to libsipc and example 5 applications using these bindings. There is also C source code that 6 is eventually compiled into a shared library. 6 7 7 The sipc_java_wrapper directory contains C source code that is eventually compiled into a shared library. 8 This shared library is necessary for the Java bindings to libsipc to be functional. The Makefile.example found 9 in this directory needs to be modified so that the build process can locate the system's JNI include files. 10 Modify the Makefile.example found in sipc_java_wrapper as appropriate, then run 'make install' in that directory. 8 To install the bindings, a few settings may need to be adjusted. The 9 Makefile in this directory may need to be modified so that the build 10 process can locate the system's JNI include files. 11 11 12 Note that the directory into which the shared library is installed must be in the dynamic linker's13 search path. 12 Note that the directory into which the shared library is installed 13 must be in the dynamic linker's search path. 14 14 trunk/libsipc/examples/Makefile
r1 r20 18 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 19 20 OBJS=mq_creator mq_destroyer mq_sender mq_reader shm_creator shm_destroyer shm_sender shm_reader 21 LDFLAGS=-L../src -lsipc -Wl,-rpath,$(SHLIBDIR) 22 SUBDIRS=policy 20 BINS = mq_creator mq_destroyer mq_sender mq_reader \ 21 shm_creator shm_destroyer shm_sender shm_reader 22 EXAMPLESDIR = $(DATAROOTDIR)/sipc 23 23 24 all: $(OBJS) 24 SUBDIRS = policy 25 26 all: $(BINS) 27 @for subdir in $(SUBDIRS); do \ 28 (cd $$subdir && $(MAKE) $@) || exit 1;\ 29 done 30 31 install: 32 @for subdir in $(SUBDIRS); do \ 33 (cd $$subdir && $(MAKE) $@) || exit 1;\ 34 done 35 36 mq_creator: mq_creator.o 37 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 38 39 mq_destroyer: mq_destroyer.o 40 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 41 42 mq_sender: mq_sender.o 43 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 44 45 mq_reader: mq_reader.o 46 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 47 48 shm_creator: shm_creator.o 49 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 50 51 shm_destroyer: shm_destroyer.o 52 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 53 54 shm_sender: shm_sender.o 55 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 56 57 shm_reader: shm_reader.o 58 $(CC) $(LDFLAGS) -lsipc $(LIBDIRS) -o $@ $^ 25 59 26 60 %.o: %.c 27 $(CC) $(CFLAGS) $( LDFLAGS) -c $*.c -o $*.o61 $(CC) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 28 62 29 install : all63 install-example: $(BINS) 30 64 test -d $(EXAMPLESDIR) || install -m 755 -d $(EXAMPLESDIR) 31 65 install -m 644 *.c $(EXAMPLESDIR) 32 66 install -m 755 *.sh $(EXAMPLESDIR) 33 install -m 755 $( OBJS) $(EXAMPLESDIR)67 install -m 755 $(BINS) $(EXAMPLESDIR) 34 68 install -m 644 data.txt $(EXAMPLESDIR) 35 69 install -m 644 Makefile $(EXAMPLESDIR) … … 40 74 41 75 clean: 42 rm -f $(OBJS) *.o *~ *#76 -rm -f $(BINS) *.o 43 77 @for subdir in $(SUBDIRS); do \ 44 78 (cd $$subdir && $(MAKE) $@) || exit 1;\ 45 79 done 80 81 .phony: all install clean examples trunk/libsipc/examples/policy/Makefile
r3 r20 1 1 AWK ?= gawk 2 2 3 EXAMPLESDIR = $(DATAROOTDIR)/sipc 3 4 FC_ENTRIES := $(shell $(AWK) '/^\/.*/{ print $$1 }' *.fc ) 4 5 FC_ENTRY = $(shell $(AWK) '/^\/.*/{ print $$1 }' $(@:.pp=.fc) ) … … 6 7 UID = $(shell id -u) 7 8 8 all: install-policy 9 all: 10 11 install: 12 13 install-example: 14 test -d $(EXAMPLESDIR)/policy || install -m 755 -d $(EXAMPLESDIR)/policy 15 install -m 644 *.te $(EXAMPLESDIR)/policy 16 install -m 644 *.fc $(EXAMPLESDIR)/policy 17 install -m 644 *.if $(EXAMPLESDIR)/policy 18 install -m 644 *.spt $(EXAMPLESDIR)/policy 19 install -m 644 Makefile $(EXAMPLESDIR)/policy 20 install -m 644 README $(EXAMPLESDIR)/policy 9 21 10 22 setup: … … 14 26 @cp /usr/share/selinux/devel/include/system/unconfined.if unconfined.if.bak && \ 15 27 cp unconfined.spt /usr/share/selinux/devel/include/system/unconfined.if 16 17 install:18 test -d $(EXAMPLESDIR)/policy || install -m 755 -d $(EXAMPLESDIR)/policy19 install -m 644 *.te $(EXAMPLESDIR)/policy20 install -m 644 *.fc $(EXAMPLESDIR)/policy21 install -m 644 *.if $(EXAMPLESDIR)/policy22 install -m 644 *.spt $(EXAMPLESDIR)/policy23 install -m 644 Makefile $(EXAMPLESDIR)/policy24 install -m 644 README $(EXAMPLESDIR)/policy25 28 26 29 install-policy: setup … … 34 37 @echo "Labeling files..." 35 38 @for file in $(FC_ENTRIES); do \ 36 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file 1>/dev/null; \37 done39 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file 1>/dev/null; \ 40 done 38 41 39 42 %.pp: setup %.te %.if %.fc … … 41 44 /usr/sbin/semodule -i $@ 42 45 for file in $(FC_ENTRY); do \ 43 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file; \44 done46 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file; \ 47 done 45 48 46 remove-policy: clean49 remove-policy: 47 50 ifneq ($(UID),0) 48 51 @echo "make $@" must be run as root since this target manipulates policy && false … … 52 55 @echo "Resetting file labels..." 53 56 @for file in $(FC_ENTRIES); do \ 54 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file 2>&1 1>/dev/null; \55 done57 /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file 2>&1 1>/dev/null; \ 58 done 56 59 echo "Finishing clean up..." 57 60 @[ -f unconfined.if.bak ] && \ … … 60 63 61 64 clean: 62 @if [ -f /usr/share/selinux/devel/include/Makefile ]; then \63 @$(MAKE) -f /usr/share/selinux/devel/include/Makefile clean; \64 fi65 65 66 .PHONY: setup install cleanremove-policy install-policy66 .PHONY: all install clean setup remove-policy install-policy trunk/libsipc/include/Makefile
r1 r20 1 PREFIX ?= $(DESTDIR)/usr 2 INCDIR ?= $(PREFIX)/include/sipc 1 all: 3 2 4 3 install: 5 test -d $(INCDIR) || install -m 755 -d $(INCDIR) 6 install -m 644 $(wildcard sipc/*.h) $(INCDIR) 7 4 test -d $(INCLUDEDIR)/sipc || install -m 755 -d $(INCLUDEDIR)/sipc 5 install -m 644 $(wildcard sipc/*.h) $(INCLUDEDIR)/sipc 6 7 clean: 8 9 .phony: all install clean trunk/libsipc/man/Makefile
r1 r20 1 MANDIR = $(DESTDIR)/usr/share/man/man3 1 all: 2 2 3 3 install: 4 mkdir -p $(MANDIR) 5 install -m 644 man3/*.3 $(MANDIR) 4 test -d $(MANDIR)/man3 || mkdir -m 755 -p $(MANDIR)/man3 5 install -m 644 $(wildcard man3/*.3) $(MANDIR)/man3 6 7 clean: 8 9 .phony: all install clean trunk/libsipc/src/Makefile
r1 r20 5 5 6 6 OBJS=$(patsubst %.c,%.o,$(wildcard *.c)) 7 LOBJS=$(patsubst %.c,%.lo,$(wildcard *.c))8 7 9 8 all: $(LIBSO) 10 9 11 $(LIBSO): $( LOBJS)12 $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(LIBSO),--version-script=libsipc.map,-z,defs 10 $(LIBSO): $(OBJS) 11 $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(LIBSO),--version-script=libsipc.map,-z,defs $(LIBDIRS) 13 12 ln -sf $@ $(TARGET) 14 13 15 %.o: %.c16 $(CC) $(CFLAGS) -c -o $@ $<14 %.o: %.c 15 $(CC) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 17 16 18 %.lo: %.c 19 $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 20 21 install: all 17 install: $(LIBSO) 22 18 test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) 23 test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) 24 install -m 755 $(LIBSO) $(SHLIBDIR) 25 cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET) 19 install -m 755 $(LIBSO) $(LIBDIR) 20 cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 26 21 27 22 clean: 28 -rm -f $(OBJS) $(LOBJS) $(LIBSO) $(TARGET) 23 -rm -f $(OBJS) $(LIBSO) $(TARGET) 24 25 .phony: all install clean trunk/libsipc/tests/Makefile
r3 r20 1 OBJS = test_ipc ipc_creator ipc_destroyer 2 LDFLAGS += -lsipc -lcunit -Wl,-rpath,$(DESTDIR)/usr/lib 3 EXE = test_ipc 1 TESTS = test_ipc ipc_creator ipc_destroyer 2 override LDFLAGS += -lsipc -lcunit -Wl,-rpath,$(LIBDIRS) 4 3 5 all: $(OBJS) 4 all: 5 6 install: 7 8 test: $(TESTS) 6 9 7 10 test_ipc: test_ipc.c shm.h shm.c mqueue.h mqueue.c 8 $(CC) $(CFLAGS) $ ^ $(LDFLAGS) -o $@11 $(CC) $(CFLAGS) $(INCLUDEDIRS) $^ $(LDFLAGS) -o $@ 9 12 10 13 ipc_creator: ipc_creator.c 11 $(CC) $(CFLAGS) $( LDFLAGS) $^ -o $@14 $(CC) $(CFLAGS) $(INLCUDEDIRS) $(LDFLAGS) $^ -o $@ 12 15 13 16 ipc_destroyer: ipc_destroyer.c 14 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 15 16 libsipc.a: 17 $(MAKE) -C ../src 17 $(CC) $(CFLAGS) $(INCLUDEDIRS) $(LDFLAGS) $^ -o $@ 18 18 19 19 clean: 20 rm -rf $(OBJS) $(EXE) *~ *.o20 -rm -rf $(TESTS) 21 21 22 .phony: all install test clean
