Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 ######################################################################
2 #
3 # A minimal 'Makefile', by Alan DeKok <[email protected]>
4 #
5 # $Id: Makefile,v 1.13 2007/03/26 04:22:11 fcusack Exp $
6 #
7 #############################################################################
8
9 #
10 # We require Make.inc, UNLESS the target is "make deb" or "make rpm"
11 #
12 # Since "make deb" re-runs configure... there's no point in
13 # requiring the developer to run configure *before* making
14 # the debian packages.
15 #
16 ifneq "$(MAKECMDGOALS)" "deb"
17 ifneq "$(MAKECMDGOALS)" "rpm"
18 $(if $(wildcard src/config.h),,$(error You must run './configure [options]' before doing 'make'))
19 $(if $(wildcard Make.inc),,$(error Missing 'Make.inc' Run './configure [options]' and retry))
20
21 include Make.inc
22 endif
23 endif
24
25 VERSION = $(shell cat VERSION)
26
27 ######################################################################
28 #
29 # If we're really paranoid, use these flags
30 #CFLAGS = -Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Waggregate-return
31 #
32 # If you're not using GCC, then you'll have to change the CFLAGS.
33 #
34 CFLAGS += -Wall
35
36 #
37 # On Irix, use this with MIPSPRo C Compiler, and don't forget to export CC=cc
38 # gcc on Irix does not work yet for pam_radius
39 # Also, use gmake instead of make
40 # Then copy pam_radius_auth.so to /usr/freeware/lib32/security (PAM dir)
41 # CFLAGS =
42
43 #LDFLAGS += -shared -Wl,--version-script=pamsymbols.ver
44 LDFLAGS += -shared
45
46 ######################################################################
47 #
48 # The default rule to build everything.
49 #
50 all: pam_radius_auth.so
51
52 ######################################################################
53 #
54 # Build the object file from the C source.
55 #
56 export CFLAGS LDFLAGS
57
58 src/pam_radius_auth.o: src/pam_radius_auth.c src/pam_radius_auth.h
59 @$(MAKE) -C src $(notdir $@)
60
61 src/md5.o: src/md5.c src/md5.h
62 @$(MAKE) -C src $(notdir $@)
63
64 #
65 # This is what should work on Irix:
66 #pam_radius_auth.so: pam_radius_auth.o md5.o
67 # ld -shared pam_radius_auth.o md5.o -L/usr/freeware/lib32 -lpam -lc -o pam_radius_auth.so
68
69 ######################################################################
70 #
71 # Build the shared library.
72 #
73 # The -Bshareable flag *should* work on *most* operating systems.
74 #
75 # On Solaris, you might try using '-G', instead.
76 #
77 # On systems with a newer GCC, you will need to do:
78 #
79 # gcc -shared pam_radius_auth.o md5.o -lpam -lc -o pam_radius_auth.so
80 #
81 pam_radius_auth.so: src/pam_radius_auth.o src/md5.o
82 $(CC) $(LDFLAGS) $^ -lpam -o pam_radius_auth.so
83
84 ######################################################################
85 #
86 # Check a distribution out of the source tree, and make a tar file.
87 #
88
89 BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
90
91 pam_radius-$(VERSION).tar.gz: .git/HEAD
92 git archive --format=tar --prefix=pam_radius-$(VERSION)/ $(BRANCH) | gzip > $@
93
94 pam_radius-$(VERSION).tar.bz2: .git/HEAD
95 git archive --format=tar --prefix=pam_radius-$(VERSION)/ $(BRANCH) | bzip2 > $@
96
97 %.sig: %
98 gpg --default-key [email protected] -b $<
99
100 .PHONY: dist
101 dist: pam_radius-$(VERSION).tar.gz pam_radius-$(VERSION).tar.bz2
102
103 dist-sign: pam_radius-$(VERSION).tar.gz.sig pam_radius-$(VERSION).tar.bz2.sig
104
105 ######################################################################
106 #
107 # Clean up everything
108 #
109 .PHONY: clean
110 clean:
111 @rm -f *~ *.so *.o src/*.o src/*~
112
113 ######################################################################
114 #
115 # Install it
116 #
117 .PHONY: install
118 install: all
119 @mkdir -p /lib/security
120 install -m 0644 pam_radius_auth.so /lib/security
121 install -m 0644 pam_radius_auth.conf /etc/pam_radius_auth.conf
122
123 ######################################################################
124 #
125 # Build a debian package
126 #
127 debian/changelog: debian/changelog.in
128 sed "s/@VERSION@/$(VERSION)/g" < $^ > $@
129
130 .PHONY: deb
131 deb: debian/changelog
132 @if ! command -v fakeroot; then \
133 if ! command -v apt-get; then \
134 echo "'make deb' only works on debian systems" ; \
135 exit 1; \
136 fi ; \
137 echo "Please run 'apt-get install build-essential fakeroot' "; \
138 exit 1; \
139 fi
140 fakeroot debian/rules debian/control
141 fakeroot dpkg-buildpackage -b -uc
142
143 #
144 # Build an RPM package
145 #
146 .PHONY: rpm
147 rpmbuild/SOURCES/pam_radius-$(VERSION).tar.bz2: pam_radius-$(VERSION).tar.bz2
148 @mkdir -p $(addprefix rpmbuild/,SOURCES SPECS BUILD RPMS SRPMS BUILDROOT)
149 @for file in `awk '/^Source...:/ {print $$2}' redhat/pam_radius_auth.spec` ; do cp redhat/$$file rpmbuild/SOURCES/$$file ; done
150 @cp $< $@
151
152 rpm: rpmbuild/SOURCES/pam_radius-$(VERSION).tar.bz2
153 @if ! yum-builddep -q -C --assumeno --define "_version $(VERSION)" redhat/pam_radius_auth.spec 1> /dev/null 2>&1; then \
154 echo "ERROR: Required dependencies not found, install them with: yum-builddep redhat/pam_radius_auth.spec"; \
155 exit 1; \
156 fi
157 @QA_RPATHS=0x0003 rpmbuild --define "_version $(VERSION)" --define "_topdir `pwd`/rpmbuild" -bb redhat/pam_radius_auth.spec