Changeset 30

Show
Ignore:
Timestamp:
05/14/08 15:30:31 (7 months ago)
Author:
jtang
Message:

Debianized libsipc library.
Fixed Makefiles to be more portable.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libsipc/Makefile

    r28 r30  
    11# Installation directories 
    2 PREFIX ?= $(DESTDIR)/usr/local 
     2PREFIX ?= /usr/local 
    33INCLUDEDIR ?= $(PREFIX)/include 
    44LIBDIR ?= $(PREFIX)/lib 
     
    1313endif 
    1414 
    15 override CFLAGS += -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE -fpic 
     15AM_CFLAGS += -Wall -Wundef -Wmissing-noreturn -D_GNU_SOURCE -fpic 
    1616# -Werror -Wwrite-strings  -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wswitch -Wshadow -Wcast-align 
    1717INCLUDEDIRS := -I$(shell pwd)/include 
     
    1919 
    2020export PREFIX INCLUDEDIR LIBDIR DATAROOTDIR MANDIR \ 
    21         CFLAGS LDFLAGS 
     21        AM_CFLAGS LDFLAGS 
    2222 
    2323# This library can optionally build bindings for other langugages. 
  • trunk/libsipc/bindings/java/Makefile

    r28 r30  
    11BINDINGSDIR = $(DATAROOTDIR)/sipc/bindings/java 
    22JARDIR = $(DATAROOTDIR)/java 
    3  
    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 CLASSES = $(patsubst %.java,%.class,$(SRC)) 
    113 
    124JAVA_HOME ?= /usr/java/default 
     
    2012LIBDIRS = -L$(TOP_BUILDDIR)/src 
    2113 
     14SRC = com/tresys/sipc/BadKeyException.java \ 
     15        com/tresys/sipc/ConnectionException.java \ 
     16        com/tresys/sipc/libsipc.java \ 
     17        com/tresys/sipc/Sipc.java \ 
     18        com/tresys/sipc/SipcMqueue.java \ 
     19        com/tresys/sipc/SipcShm.java 
     20CLASSES = $(patsubst %.java,%.class,$(SRC)) 
     21 
     22SOVERSION = 1 
     23RELEASE = 0 
     24JARTARGET = libsipc-$(SOVERSION).$(RELEASE).jar 
     25 
    2226# Change the following to be appropriate for your system: 
    2327# 
    24 # JNI_CFLAGS:         Location of JNI include files. 
     28# JNI_CFLAGS: Location of JNI include files. 
    2529#               Only set this value if JNI's include files 
    2630#               are installed outside of the compiler's search path. 
     
    2933JNI_CFLAGS=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fno-strict-aliasing 
    3034 
    31 LIBVERSION = 0.1 
    3235TARGET = libsipcwrapper.so 
    33 LIBSO = $(TARGET).$(LIBVERSION) 
     36SONAME = $(TARGET).$(SOVERSION) 
     37LIBSO = $(TARGET).$(SOVERSION).$(RELEASE) 
    3438OBJS = sipc_wrap.o 
    3539 
    36 all: libsipc.jar $(LIBSO) 
     40all: $(JARTARGET) $(LIBSO) 
    3741 
    38 install: 
    39         test -d $(BINDINGSDIR) || install -m 755 -d $(BINDINGSDIR) 
    40         test -d $(BINDINGSDIR)/examples || install -m 755 -d $(BINDINGSDIR)/examples 
    41         install -m 644 README $(BINDINGSDIR) 
    42         install -m 644 examples/* $(BINDINGSDIR)/examples 
    43         install -m 644 libsipc.jar $(BINDINGSDIR) 
    44         test -d $(JARDIR) || install -m 755 -d $(JARDIR) 
    45         cd $(JARDIR) && ln -sf $(BINDINGSDIR)/libsipc.jar libsipc.jar 
    46         test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) 
    47         install -m 755 $(LIBSO) $(LIBDIR) 
    48         cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 
     42install: $(JARTARGET) $(LIBSO) 
     43        test -d $(DESTDIR)/$(BINDINGSDIR) || install -m 755 -d $(DESTDIR)/$(BINDINGSDIR) 
     44        test -d $(DESTDIR)/$(BINDINGSDIR)/examples || install -m 755 -d $(DESTDIR)/$(BINDINGSDIR)/examples 
     45        install -m 644 README $(DESTDIR)/$(BINDINGSDIR) 
     46        install -m 644 examples/* $(DESTDIR)/$(BINDINGSDIR)/examples 
     47        install -m 644 $(JARTARGET) $(DESTDIR)/$(BINDINGSDIR) 
     48        test -d $(DESTDIR)/$(JARDIR) || install -m 755 -d $(DESTDIR)/$(JARDIR) 
     49        cd $(DESTDIR)/$(JARDIR) && ln -sf $(BINDINGSDIR)/$(JARTARGET) libsipc.jar 
     50        cd $(DESTDIR)/$(JARDIR) && ln -sf $(BINDINGSDIR)/$(JARTARGET) $(JARTARGET) 
     51        test -d $(DESTDIR)/$(LIBDIR) || install -m 755 -d $(DESTDIR)/$(LIBDIR) 
     52        install -m 644 $(LIBSO) $(DESTDIR)/$(LIBDIR) 
     53        cd $(DESTDIR)/$(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 
     54        cd $(DESTDIR)/$(LIBDIR) && ln -sf $(LIBSO) $(TARGET).$(SOVERSION) 
    4955 
    50 libsipc.jar: $(CLASSES) 
    51         $(JAR) cf libsipc.jar $(CLASSES) 
     56$(JARTARGET): $(CLASSES) 
     57        $(JAR) cf $@ $(CLASSES) 
    5258 
    5359%.class: %.java 
     
    5561 
    5662$(LIBSO): $(OBJS) 
    57         $(CC) $(LDFLAGS) $(LIBDIRS) -lsipc -shared -o $@ $< 
     63        $(CC) $(LDFLAGS) $(LIBDIRS) -Wl,-soname,$(SONAME) -lsipc -shared -o $@ $< 
    5864        ln -sf $@ $(TARGET) 
    5965 
    6066%.o: %.c 
    61         $(CC) $(CFLAGS) $(INCLUDEDIRS) $(JNI_CFLAGS) -fPIC -c -o $@ $< 
     67        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INCLUDEDIRS) $(JNI_CFLAGS) -fPIC -c -o $@ $< 
    6268 
    6369javadoc: 
     
    6571 
    6672clean: 
    67         -rm -f $(CLASSES) libsipc.jar $(TARGET) $(LIBSO) $(OBJS) 
     73        -rm -f $(CLASSES) $(JARTARGET) $(TARGET) $(LIBSO) $(OBJS) 
    6874 
    6975.PHONY: all install clean javadoc 
  • trunk/libsipc/examples/Makefile

    r28 r30  
    7070 
    7171%.o: %.c 
    72         $(CC) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 
     72        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 
    7373 
    7474install-example: $(BINS) 
     
    7878        install -m 755 $(BINS) $(EXAMPLESDIR) 
    7979        install -m 644 data.txt $(EXAMPLESDIR) 
    80         install -m 644 Makefile $(EXAMPLESDIR)          
    81         install -m 644 README $(EXAMPLESDIR)            
     80        install -m 644 Makefile $(EXAMPLESDIR) 
     81        install -m 644 README $(EXAMPLESDIR) 
    8282        @for subdir in $(SUBDIRS); do \ 
    8383                (cd $$subdir && $(MAKE) $@) || exit 1;\ 
  • trunk/libsipc/examples/policy/Makefile

    r20 r30  
    1212 
    1313install-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 
     14        test -d $(DESTDIR)/$(EXAMPLESDIR)/policy || install -m 755 -d $(DESTDIR)/$(EXAMPLESDIR)/policy 
     15        install -m 644 *.te $(DESTDIR)/$(EXAMPLESDIR)/policy 
     16        install -m 644 *.fc $(DESTDIR)/$(EXAMPLESDIR)/policy 
     17        install -m 644 *.if $(DESTDIR)/$(EXAMPLESDIR)/policy 
     18        install -m 644 *.spt $(DESTDIR)/$(EXAMPLESDIR)/policy 
     19        install -m 644 Makefile $(DESTDIR)/$(EXAMPLESDIR)/policy 
     20        install -m 644 README $(DESTDIR)/$(EXAMPLESDIR)/policy 
    2121 
    22 setup:  
     22setup: 
    2323ifneq ($(UID),0) 
    24         @echo "make $@" must be run as root since this target manipulates policy && false  
     24        @echo "make $@" must be run as root since this target manipulates policy && false 
    2525endif 
    2626        @cp /usr/share/selinux/devel/include/system/unconfined.if unconfined.if.bak && \ 
    27         cp unconfined.spt /usr/share/selinux/devel/include/system/unconfined.if  
     27        cp unconfined.spt /usr/share/selinux/devel/include/system/unconfined.if 
    2828 
    2929install-policy: setup 
    3030ifneq ($(UID),0) 
    31         @echo "make $@" must be run as root since this target manipulates policy && false  
     31        @echo "make $@" must be run as root since this target manipulates policy && false 
    3232endif 
    3333        @echo "Building policy modules..." 
    3434        @$(MAKE) -f /usr/share/selinux/devel/include/Makefile 1>/dev/null 
    3535        @echo "Inserting policy modules..." 
    36         @/usr/sbin/semodule `ls *.pp|sed 's/^\(.*\)$$/ -i \1/g'`  
     36        @/usr/sbin/semodule `ls *.pp|sed 's/^\(.*\)$$/ -i \1/g'` 
    3737        @echo "Labeling files..." 
    3838        @for file in $(FC_ENTRIES); do \ 
     
    5151        @echo "make $@" must be run as root since this target manipulates policy && false 
    5252endif 
    53         @echo "Removing modules..."  
     53        @echo "Removing modules..." 
    5454        @/usr/sbin/semodule `ls *.te|sed 's/^\(.*\)\.te$$/ -r \1/g'` || true 
    5555        @echo "Resetting file labels..." 
    5656        @for file in $(FC_ENTRIES); do \ 
    5757                /usr/sbin/setfiles -v /etc/selinux/targeted/contexts/files/file_contexts $$file 2>&1 1>/dev/null; \ 
    58         done  
     58        done 
    5959        echo "Finishing clean up..." 
    6060        @[ -f unconfined.if.bak ] && \ 
  • trunk/libsipc/include/Makefile

    r28 r30  
    22 
    33install: 
    4         test -d $(INCLUDEDIR)/sipc || install -m 755 -d $(INCLUDEDIR)/sipc 
    5         install -m 644 $(wildcard sipc/*.h) $(INCLUDEDIR)/sipc 
     4        test -d $(DESTDIR)/$(INCLUDEDIR)/sipc || install -m 755 -d $(DESTDIR)/$(INCLUDEDIR)/sipc 
     5        install -m 644 $(wildcard sipc/*.h) $(DESTDIR)/$(INCLUDEDIR)/sipc 
    66 
    77clean: 
  • trunk/libsipc/man/Makefile

    r28 r30  
    22 
    33install: 
    4         test -d $(MANDIR)/man3 || mkdir -m 755 -p $(MANDIR)/man3 
    5         install -m 644 $(wildcard man3/*.3) $(MANDIR)/man3 
     4        test -d $(DESTDIR)/$(MANDIR)/man3 || mkdir -m 755 -p $(DESTDIR)/$(MANDIR)/man3 
     5        install -m 644 $(wildcard man3/*.3) $(DESTDIR)/$(MANDIR)/man3 
    66 
    77clean: 
  • trunk/libsipc/src/Makefile

    r28 r30  
    1 LIBVERSION=1.0 
     1SOVERSION=1 
     2RELEASE=0 
    23 
    34TARGET=libsipc.so 
    4 LIBSO=$(TARGET).$(LIBVERSION) 
     5SONAME=$(TARGET).$(SOVERSION) 
     6LIBSO=$(TARGET).$(SOVERSION).$(RELEASE) 
    57 
    68TOP_SRCDIR ?= .. 
     
    1214 
    1315$(LIBSO): $(OBJS) 
    14         $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(LIBSO),--version-script=libsipc.map,-z,defs $(LIBDIRS) 
     16        $(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(SONAME),--version-script=libsipc.map,-z,defs $(LIBDIRS) 
    1517        ln -sf $@ $(TARGET) 
    1618 
    1719%.o: %.c 
    18         $(CC) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 
     20        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INCLUDEDIRS) -c -o $@ $< 
    1921 
    2022install: $(LIBSO) 
    21         test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) 
    22         install -m 755 $(LIBSO) $(LIBDIR) 
    23         cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 
     23        test -d $(DESTDIR)/$(LIBDIR) || install -m 755 -d $(DESTDIR)/$(LIBDIR) 
     24        install -m 644 $(LIBSO) $(DESTDIR)/$(LIBDIR) 
     25        cd $(DESTDIR)/$(LIBDIR) && ln -sf $(LIBSO) $(TARGET) 
     26        cd $(DESTDIR)/$(LIBDIR) && ln -sf $(LIBSO) $(TARGET).$(SOVERSION) 
    2427 
    2528clean: 
  • trunk/libsipc/src/mqueue_internal.c

    r24 r30  
    2020 
    2121#include <stdio.h> 
    22 #include <sipc/sipc.h> 
    2322#include <sys/types.h> 
    2423#include <sys/ipc.h> 
     
    2726#include <errno.h> 
    2827#include <fcntl.h> 
     28#include "sipc/sipc.h" 
    2929#include "mqueue_internal.h" 
    3030 
  • trunk/libsipc/src/shm_internal.c

    r1 r30  
    2525#include <string.h> 
    2626#include <errno.h> 
    27 #include <sipc/sipc.h> 
     27#include "sipc/sipc.h" 
    2828#include "sipc_internal.h" 
    2929#include "sipc_mqueue.h" 
  • trunk/libsipc/src/sipc_shm.c

    r21 r30  
    2424#include <string.h> 
    2525#include <errno.h> 
    26 #include <sipc/sipc.h> 
    2726#include <sys/ipc.h> 
    2827#include <sys/shm.h> 
     
    3130#include <sys/stat.h> 
    3231#include <fcntl.h> 
     32#include "sipc/sipc.h" 
    3333#include "sipc_internal.h" 
    3434#include "sipc_shm.h" 
  • trunk/libsipc/tests/Makefile

    r28 r30  
    11TESTS = test_ipc ipc_creator ipc_destroyer 
    2 override LDFLAGS += -lsipc -lcunit -Wl,-rpath,$(LIBDIRS) 
     2AM_LDFLAGS = -lsipc -lcunit -Wl,-rpath,$(LIBDIRS) 
    33 
    44all: 
     
    99 
    1010test_ipc: test_ipc.c shm.h shm.c mqueue.h mqueue.c 
    11         $(CC) $(CFLAGS) $(INCLUDEDIRS) $^ $(LDFLAGS) -o $@ 
     11        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INCLUDEDIRS) $^ $(AM_LDFLAGS) $(LDFLAGS) -o $@ 
    1212 
    1313ipc_creator: ipc_creator.c 
    14         $(CC) $(CFLAGS) $(INLCUDEDIRS) $(LDFLAGS) $^ -o $@ 
     14        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INLCUDEDIRS) $(AM_LDFLAGS) $(LDFLAGS) $^ -o $@ 
    1515 
    1616ipc_destroyer: ipc_destroyer.c 
    17         $(CC) $(CFLAGS) $(INCLUDEDIRS) $(LDFLAGS) $^ -o $@ 
     17        $(CC) $(AM_CFLAGS) $(CFLAGS) $(INCLUDEDIRS) $(AM_LDFLAGS) $(LDFLAGS) $^ -o $@ 
    1818 
    1919clean: