1
# $Id: Makefile 199 2006-11-04 21:34:47Z steve-beattie $
2
# ----------------------------------------------------------------------
3
# Copyright (c) 2004, 2005, 2006 NOVELL (All rights reserved)
5
# This program is free software; you can redistribute it and/or
6
# modify it under the terms of version 2.1 of the GNU Lesser
7
# General Public License published by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU Lesser General Public
15
# License along with this program; if not, contact Novell, Inc.
16
# ----------------------------------------------------------------------
19
COMMONDIR:=$(strip $(shell if [ -d "../common/" ] ; then \
21
elif [ -d "../../common/" ] ; then \
22
echo "../../common/" ; \
24
echo "/common_dir_not_found" ; \
27
include common/Make.rules
29
COMMONDIR_EXISTS=$(strip $(shell [ -d ${COMMONDIR} ] && echo true))
30
ifeq ($(COMMONDIR_EXISTS), true)
31
common/Make.rules: $(COMMONDIR)/Make.rules
41
TARGETS=${TARGET}.so ${TARGET}.a
43
OLDTARGET=libimmunix.so.1
46
TESTS=tst-sgdh tst-cdh tst-sgkey tst-sgdh-static tst-cdh-static tst-sgkey-static
48
CFLAGS=-g -O2 -Wall -Wstrict-prototypes -pipe
49
EXTRA_CFLAGS=$(CFLAGS) -fpic -D_REENTRANT
52
TEST_CFLAGS=$(CFLAGS) $(CANARY_FLAG) $(FORMATGUARD_FLAG)
53
TEST_LDFLAGS= -L. -limmunix
55
all: ${TARGETS} ${OLDTARGET}
58
$(CC) ${EXTRA_CFLAGS} -c -shared -o $@ $<
60
${TARGET}.so: ${OBJECTS}
61
${CC} ${EXTRA_CFLAGS} -o $@.$(SO_VERS) -Wl,-soname,$@.$(SO_VERS) -Wl,--version-script=${TARGET}.map -W,-z,defs -shared -dynamic $^
62
ln -fs $@.$(SO_VERS) $@
64
${OLDTARGET}: ${OBJECTS} libimmunix_warning.o
65
${CC} ${EXTRA_CFLAGS} -o $@ -Wl,-soname,$@ -Wl,--version-script=${TARGET}.map -W,-z,defs -shared -dynamic $^
67
${TARGET}.a: ${OBJECTS}
70
${POSTINSTALLBIN}: ${POSTINSTALLBIN}.c
71
$(CC) -static -Os -o $@ $(CANARY_FLAG) $(FORMATGUARD_FLAG) $^
73
# Ugh, dunno how to do an auto rule for the TESTS
74
tst-sgdh: tst-sgdh.c ${TARGET}.so
75
$(CC) ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
77
tst-cdh: tst-cdh.c ${TARGET}.so
78
$(CC) ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
80
tst-sgkey: tst-sgkey.c ${TARGET}.so
81
$(CC) ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
83
tst-sgdh-static: tst-sgdh.c ${TARGET}.a
84
$(CC) -static ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
86
tst-cdh-static: tst-cdh.c ${TARGET}.a
87
$(CC) -static ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
89
tst-sgkey-static: tst-sgkey.c ${TARGET}.a
90
$(CC) -static ${TEST_CFLAGS} -o $@ $< ${TEST_LDFLAGS}
93
-LD_LIBRARY_PATH=. ./tst-sgdh
94
-LD_LIBRARY_PATH=. ./tst-cdh
95
-LD_LIBRARY_PATH=. ./tst-sgkey
101
install: $(SPECFILE) $(TARGETS) $(OLDTARGET)
102
install -d $(DESTDIR)/${LIB} $(DESTDIR)${LIBDIR}
103
install -d ${DESTDIR}/usr/include/sys
104
mv -f $(TARGET).so.$(SO_VERS) $(TARGET)-$(VERSION)-$(RELEASE).so.$(SO_VERS)
105
install -m 755 $(TARGET)-$(VERSION)-$(RELEASE).so.$(SO_VERS) ${DESTDIR}/${LIB}
106
${LDCONFIG} -n ${DESTDIR}/${LIB}
107
install -m 755 $(TARGET).a ${DESTDIR}${LIBDIR}
108
install -m 644 apparmor.h ${DESTDIR}/usr/include/sys
109
ln -sf /${LIB}/$(TARGET).so.$(SO_VERS) ${DESTDIR}${LIBDIR}/$(TARGET).so
110
# compatability with old libimmunix
111
install -m 755 $(OLDTARGET) ${DESTDIR}/${LIB}
112
ln -sf apparmor.h ${DESTDIR}/usr/include/sys/immunix.h
116
rm -f *.o $(TARGET)*.so* ${TARGETS} ${OLDTARGET} Make.rules
117
rm -f ${NAME}-${VERSION}*.tar.gz ${TESTS} $(NAME)-*.tgz ${SPECFILE}