summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2013-04-25 14:22:49 +0200
committerTimo Weingärtner <timo@tiwe.de>2013-04-25 19:51:37 +0200
commit0148de59cdcea4013d694fc04db3174ce06c60b1 (patch)
tree3932e77768472250b3626ce3252e12fb998aa57e
parent5dbeed06ae0b0f168158920c59dcfb0cc822dee6 (diff)
downloadlibpam-pwdfile-0148de59cdcea4013d694fc04db3174ce06c60b1.tar.gz
rework Makefile for standalone building
if this is ever integrated into pam it will be autotools anyways use ?= and += to better work with distribution's build systems
-rw-r--r--Makefile122
-rw-r--r--contrib/Makefile.standalone47
-rw-r--r--contrib/Makefile.standalone-0.9526
3 files changed, 25 insertions, 170 deletions
diff --git a/Makefile b/Makefile
index da956d3..364cee0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,112 +1,40 @@
-# $Id: Makefile,v 1.5 2002-06-09 21:01:46 cpbotha Exp $
-#
-# This Makefile controls a build process of $(TITLE) module for
-# Linux-PAM. You should not modify this Makefile (unless you know
-# what you are doing!).
-#
+PAM_LIB_DIR ?= $(DESTDIR)/lib/security
+INSTALL ?= install
+CFLAGS ?= -O2 -g -Wall -Wformat-security
-include ../../Make.Rules
+CFLAGS += -fPIC
+LDFLAGS += -Wl,-x -shared
-ifeq ($(HAVE_LIBCRYPT),yes)
- EXTRALS += -lcrypt
-endif
-
-TITLE=pam_pwdfile
-CFLAGS += -D_BSD_SOURCE
-
-md5_good.o: md5.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' \
- $(TARGET_ARCH) -c $< -o $@
-
-md5_broken.o: md5.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
- $(TARGET_ARCH) -c $< -o $@
-
-md5_crypt_good.o: md5_crypt.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Good##x' \
- $(TARGET_ARCH) -c $< -o $@
-
-md5_crypt_broken.o: md5_crypt.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
- $(TARGET_ARCH) -c $< -o $@
-
-##### The following mostly from Simple.Rules
-##### * modifications to first 5 definitions
-
-LIBFILES = $(TITLE) bigcrypt
-LIBSRC = $(addsuffix .c,$(LIBFILES)) md5.c md5_crypt.c
-LIBOBJ = $(addsuffix .o,$(LIBFILES))
-LIBOBJD = $(addprefix dynamic/,$(LIBOBJ)) md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o
-LIBOBJS = $(addprefix static/,$(LIBOBJ)) md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o
-
-ifdef DYNAMIC
+TITLE = pam_pwdfile
LIBSHARED = $(TITLE).so
-endif
-
-ifdef STATIC
-LIBSTATIC = lib$(TITLE).o
-endif
-
-####################### don't edit below #######################
+LDLIBS = -lcrypt -lpam
+LIBOBJ = $(TITLE).o md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o bigcrypt.o
+CPPFLAGS_MD5_GOOD = -D'MD5Name(x)=Good\#\#x'
+CPPFLAGS_MD5_BROKEN = -DHIGHFIRST -D'MD5Name(x)=Broken\#\#x'
-all: dirs $(LIBSHARED) $(LIBSTATIC) register
-dynamic/%.o : %.c
- $(CC) $(CFLAGS) $(DYNAMIC) $(TARGET_ARCH) -c $< -o $@
+all: $(LIBSHARED)
-static/%.o : %.c
- $(CC) $(CFLAGS) $(STATIC) $(TARGET_ARCH) -c $< -o $@
+$(LIBSHARED): $(LIBOBJ)
+ $(CC) $(LDFLAGS) $(LIBOBJ) $(LDLIBS) -o $@
-dirs:
-ifdef DYNAMIC
- $(MKDIR) ./dynamic
-endif
-ifdef STATIC
- $(MKDIR) ./static
-endif
-register:
-ifdef STATIC
- ( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
-endif
-
-ifdef DYNAMIC
-$(LIBOBJD): $(LIBSRC)
-endif
+md5_good.o: md5.c
+ $(CC) -c $(CPPFLAGS) $(CPPFLAGS_MD5_GOOD) $(CFLAGS) $< -o $@
-ifdef DYNAMIC
-$(LIBSHARED): $(LIBOBJD)
- $(LD_D) -o $@ $(LIBOBJD) $(EXTRALS) $(NEED_LINK_LIB_C)
-endif
+md5_broken.o: md5.c
+ $(CC) -c $(CPPFLAGS) $(CPPFLAGS_MD5_BROKEN) $(CFLAGS) $< -o $@
-ifdef STATIC
-$(LIBOBJS): $(LIBSRC)
-endif
+md5_crypt_good.o: md5_crypt.c
+ $(CC) -c $(CPPFLAGS) $(CPPFLAGS_MD5_GOOD) $(CFLAGS) $< -o $@
-ifdef STATIC
-$(LIBSTATIC): $(LIBOBJS)
- $(LD) -r -o $@ $(LIBOBJS) $(EXTRALS)
-endif
+md5_crypt_broken.o: md5_crypt.c
+ $(CC) -c $(CPPFLAGS) $(CPPFLAGS_MD5_BROKEN) $(CFLAGS) $< -o $@
-install: all
- $(MKDIR) $(FAKEROOT)$(SECUREDIR)
-ifdef DYNAMIC
- $(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
-endif
- $(MODULE_SIMPLE_INSTALL)
-remove:
- rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
- $(MODULE_SIMPLE_REMOVE)
+install: $(LIBSHARED)
+ $(INSTALL) -m 0755 -d $(PAM_LIB_DIR)
+ $(INSTALL) -m 0755 $(LIBSHARED) $(PAM_LIB_DIR)
clean:
- rm -f $(LIBOBJD) $(LIBOBJS) core *~
- $(MODULE_SIMPLE_CLEAN)
- rm -f *.a *.o *.so *.bak
- rm -rf dynamic static
- $(MODULE_SIMPLE_EXTRACLEAN)
-
-.c.o:
- $(CC) $(CFLAGS) -c $<
-
-
+ $(RM) *.o *.so
diff --git a/contrib/Makefile.standalone b/contrib/Makefile.standalone
deleted file mode 100644
index 857eaff..0000000
--- a/contrib/Makefile.standalone
+++ /dev/null
@@ -1,47 +0,0 @@
-PAM_LIB_DIR = /lib/security
-CC = gcc
-LD = ld
-INSTALL = /usr/bin/install
-CFLAGS = -fPIC -O2 -c -g -Wall -Wformat-security
-LDFLAGS = -x --shared
-PAMLIB = -lpam
-CRYPTLIB = -lcrypt
-CPPFLAGS =
-
-all: pam_pwdfile.so
-
-pam_pwdfile.so: pam_pwdfile.o bigcrypt.o md5_good.o md5_crypt_good.o md5_broken.o md5_crypt_broken.o
- $(LD) $(LDFLAGS) -o pam_pwdfile.so pam_pwdfile.o md5_good.o md5_crypt_good.o md5_broken.o md5_crypt_broken.o bigcrypt.o $(PAMLIB) $(CRYPTLIB)
-
-pam_pwdfile.o: pam_pwdfile.c
- $(CC) $(CFLAGS) pam_pwdfile.c
-
-bigcrypt.o: bigcrypt.c
- $(CC) $(CFLAGS) bigcrypt.c
-
-
-md5_good.o: md5.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' -c $< -o $@
-
-md5_broken.o: md5.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
- -c $< -o $@
-
-md5_crypt_good.o: md5_crypt.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Good##x' \
- -c $< -o $@
-
-md5_crypt_broken.o: md5_crypt.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
- -c $< -o $@
-
-
-install: pam_pwdfile.so
- $(INSTALL) -m 0755 -d $(PAM_LIB_DIR)
- $(INSTALL) -m 0755 pam_pwdfile.so $(PAM_LIB_DIR)
-
-clean:
- rm -f pam_pwdfile.o pam_pwdfile.so
-
-spotless:
- rm -f pam_pwdfile.so pam_pwdfile.o *~ core
diff --git a/contrib/Makefile.standalone-0.95 b/contrib/Makefile.standalone-0.95
deleted file mode 100644
index 136f04a..0000000
--- a/contrib/Makefile.standalone-0.95
+++ /dev/null
@@ -1,26 +0,0 @@
-PAM_LIB_DIR = /lib/security
-CC = gcc
-LD = ld
-INSTALL = /usr/bin/install
-CFLAGS = -fPIC -O2 -c -g -Wall -Wformat-security
-LDFLAGS = -x --shared
-PAMLIB = -lpam
-CRYPTLIB = -lcrypt
-
-all: pam_pwdfile.so
-
-pam_pwdfile.so: pam_pwdfile.o
- $(LD) $(LDFLAGS) -o pam_pwdfile.so pam_pwdfile.o $(PAMLIB) $(CRYPTLIB)
-
-pam_pwdfile.o: pam_pwdfile.c
- $(CC) $(CFLAGS) pam_pwdfile.c
-
-install: pam_pwdfile.so
- $(INSTALL) -m 0755 -d $(PAM_LIB_DIR)
- $(INSTALL) -m 0755 pam_pwdfile.so $(PAM_LIB_DIR)
-
-clean:
- rm -f pam_pwdfile.o pam_pwdfile.so
-
-spotless:
- rm -f pam_pwdfile.so pam_pwdfile.o *~ core