5 ## Note, ideally I would prefer it if this top level makefile did
6 ## not get created by autoconf. As I find typing 'make' and relying
7 ## on it to take care of all dependencies much more friendly than
8 ## the multi-stage autoconf+make and also worry about updates to
9 ## configure.in not getting propagated down the tree. (AGM) [I realise
10 ## that this may not prove possible, but at least I tried.. Sigh.]
14 ifeq ($(shell test \! -f Make.Rules || echo yes),yes)
18 THINGSTOMAKE = modules libpam libpamc libpam_misc doc examples
27 if [ ! -f Make.Rules ]; then touch Make.Rules ; fi
28 for i in $(THINGSTOMAKE) ; do $(MAKE) -C $$i clean ; done
29 rm -f security *~ *.orig *.rej Make.Rules #*#
32 rm -f Make.Rules _pam_aconf.h
33 rm -f config.status config.cache config.log core
35 maintainer-clean: distclean
36 @echo files should be ok for packaging now.
38 # NB _pam_aconf.h.in changes will remake this too
39 Make.Rules: configure Make.Rules.in _pam_aconf.h.in
40 @echo XXX - not sure how to preserve past configure options..
41 @echo XXX - so not attempting to. Feel free to run ./configure
42 @echo XXX - by hand, with the options you want.
45 _pam_aconf.h: Make.Rules
47 configure: configure.in
49 @echo You do not appear to have an up-to-date ./configure file.
50 @echo Please run autoconf, and then ./configure [..options..]
55 $(THINGSTOMAKE): _pam_aconf.h prep
58 install: _pam_aconf.h prep
59 $(MKDIR) $(FAKEROOT)$(INCLUDED)
60 $(INSTALL) -m 444 security/_pam_aconf.h $(FAKEROOT)$(INCLUDED)
61 for x in $(THINGSTOMAKE) ; do make -C $$x install ; done
64 rm -f $(FAKEROOT)$(INCLUDED)/_pam_aconf.h
65 for x in $(THINGSTOMAKE) ; do make -C $$x remove ; done
68 @if [ ! -f Make.Rules ]; then echo make Make.Rules first ; exit 1; fi
69 @if [ ! -L ../$(DISTNAME)-$(MAJOR_REL).$(MINOR_REL) ]; then \
70 echo generating ../$(DISTNAME)-$(MAJOR_REL).$(MINOR_REL) link ; \
71 ln -sf $(DISTNAME) ../$(DISTNAME)-$(MAJOR_REL).$(MINOR_REL) ; \
72 echo to ../$(DISTNAME) . ; fi
73 @diff ../$(DISTNAME)-$(MAJOR_REL).$(MINOR_REL)/Make.Rules Make.Rules
75 cd .. ; tar zvfc $(DISTNAME)-$(MAJOR_REL).$(MINOR_REL).tar.gz --exclude CVS --exclude .cvsignore --exclude '.#*' $(DISTNAME)-$(MAJOR_REL).$(MINOR_REL)/*
79 ifdef LEGACY_OLD_MAKEFILE
81 # major and minor numbers of this release
87 # this should be the name of this directory (under CVS)
89 # this should be the name of this directory (when generating the release)
90 RELNAME = $(DISTNAME)-$(MAJOR_REL).$(MINOR_REL)
92 # this is the name of the archive file
93 DISTFILE = $(RELNAME).tar.gz
95 # define this to indicate to subdirectories that they are part of the
97 FULL_LINUX_PAM_SOURCE_TREE=yes
98 export FULL_LINUX_PAM_SOURCE_TREE
103 # Comment out either line to disable that type of linking for *modules only*
104 # Both at once is a legal configuration!
105 DYNAMIC=-DPAM_DYNAMIC
108 # Comment out these lines to disable building dynamic/static libpam.*
112 # All combinations of the above four variable definitions are legal,
113 # however, not defining either dynamic or static modules and yet
114 # creating a some flavor of LIBPAM will make an authentication library
117 # Here we indicate which libraries are present on the local system
118 # they control the building of some modules in this distribution
119 # Note, these definitions are all "export"ed below...
126 # NB. The following is the generic defines for compilation.
127 # They can be overridden in the default.defs file below
129 WARNINGS = -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
130 -Wpointer-arith -Wcast-qual -Wcast-align \
131 -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
132 -Wnested-externs -Winline -Wshadow -pedantic
135 # Mode to install shared libraries with
139 # Conditional defines..
143 # need the dynamic library functions
146 # needed because pam_xxx() fn's are now in statically linked library
151 # Here we include the defines for the preferred operating system
152 # these include things like CC, CFLAGS and destination directories
153 # etc.. By default, this is a symbolic link to one of the .defs files
154 # the .../defs/ directory. Please take a moment to check that you are
155 # using the correct one.
159 # to turn on the fprintf(stderr, ..) debugging lines throughout the
160 # distribution uncomment this line
163 # For serious memory allocation tracing uncomment the following
164 #MEMORY_DEBUG=-DMEMORY_DEBUG
166 #######################################################################
167 # The pam_unix module in this file will not work on NIS based systems.#
168 #######################################################################
170 # ////////////////////////////////////////////////////
171 # // You should not modify anything below this line //
172 # ////////////////////////////////////////////////////
174 # the sub-directories to make things in
176 DIRS = modules libpam conf libpam_misc libpamc examples
182 INCLUDEDIR=-I$(shell pwd)/include
183 PAMLIB=-L$(shell pwd)/libpam
184 PAMMISCLIB=-L$(shell pwd)/libpam_misc
185 ifeq ($(DEBUG_REL),yes)
187 PAMMISCLIB += -lpamd_misc
190 PAMMISCLIB += -lpam_misc
194 # This is Linux-PAM and not a version from Sun etc..
195 # [Note, this does not describe the operating system you are using
196 # only that you are compiling the "Linux" (read FREE) implementation
197 # of Pluggable Authentication Modules.
198 EXTRAS += -DLINUX_PAM
201 # build composite defines
204 LOADLIBES = $(PAMLIB) $(RDYNAMIC) $(PAMMISCLIB) $(LIBDL) $(ULIBS)
206 CFLAGS += $(EXTRAS) $(MEMORY_DEBUG) $(WARNINGS) $(INCLUDEDIR) $(PIC)
207 ifneq ($(strip $(OS)),)
210 ifneq ($(strip $(ARCH)),)
215 # export the libraries-available info; the modules should know how
216 # to deal with this...
226 export MAJOR_REL # the major release of this distribution
227 export MINOR_REL # the minor release of this distribution
228 export DEBUG_REL # for installing a debugging version of PAM
229 export OS # operating system
230 export ARCH # architecture
231 export CC # the C compiler
232 export INSTALL # to do instalations with
233 export MKDIR # to ensure directories exist
234 export CFLAGS # CC flags used to compile everything
235 export LD_D # build a shared object file (module)
236 export LD_L # build a shared library (e.g. libpam)
237 export USESONAME # does shlib link command require soname option
238 export SOSWITCH # shlib lib soname switch name
239 export LINKLIBS # libraries to append when making dynamic libs
240 export NEEDSONAME # does shared library link need versioned lib
241 export LD # build a generic library
242 export LDCONFIG # rebuild the shared libraries
243 export AR # build a static library
244 export RANLIB # reorder a static library
245 export LOADLIBES # libraries needed for application linking
246 export PAMLIB # where to find the local libpam.xx file
247 export DYNTYPE # which suffix is used for libraries
248 export SHLIBMODE # file mode for shared objects
249 export EXTRALS # libraries that some modules need
250 export LIBDL # extra library for libpam.so
252 # where to install things
254 export FAKEROOT # for package maintainers
256 export PREFIX # basic prefix for all other directories
257 export SUPLEMENTED # where to store module helper binaries
258 export LIBDIR # where libpam and libpam_misc go
259 export SECUREDIR # where the modules will be placed
260 export INCLUDED # where to store pam---.h files
261 export CONFIGED # where pam.conf and pam.d/ go
262 export SCONFIGED # where modules' config files go
265 # Conditional exporting ( ... these go on for a while... )
274 export DYNAMIC_LIBPAM
287 all: .freezemake headers
289 @for i in $(DIRS) ; do \
290 $(MAKE) -C $$i all ; \
291 if [ $$? -ne 0 ]; then break ; fi ; \
294 .freezemake: Makefile
296 @echo "*WARNING*: If you are running a system that is dependent"
297 @echo " on PAM to work. DO NOT make sterile NOR make remove."
298 @echo " These options will delete the PAM files on your system"
299 @echo " and make it unusable!"
301 @echo "If you are in any doubt, just do 'make all' (or just"
302 @echo "'make'). It is likely that this is the SAFEST thing to do...."
306 @for i in $(DIRS) ; do \
307 $(MAKE) -C $$i install ; \
308 if [ $$? -ne 0 ]; then break ; fi ; \
316 @for i in $(DIRS) ; do \
317 $(MAKE) -C $$i remove ; \
322 @for i in $(DIRS) ; do \
323 $(MAKE) -C $$i clean ; \
327 @mkdir -p include/security && cd include/security \
328 && ln -fs ../../libpam/include/security/*.h . \
329 && ln -fs ../../libpam_misc/*.h . \
330 && ln -fs ../../libpamc/include/security/*.h .
333 @cd include/security ; rm -f *.h
337 @for i in $(DIRS) doc ; do \
338 $(MAKE) -C $$i extraclean ; \
342 @$(MAKE) -C conf check
345 @find . \( -type f -a -perm 644 \) -print
348 @egrep '^DEBUG\_REL\=yes' Makefile|grep -v grep > /dev/null ;\
349 if [ $$? -eq 0 ]; then \
350 echo "You should first set DEBUG_REL to no" ; exit 1 ; fi
355 cd .. ; find $(RELNAME) \! -type d -print | fgrep -v 'conf/.md5sum' > $(RELNAME)/.filelist
358 (cat .filelist ; echo $(RELNAME)/conf/.md5sum) | (cd .. ; tar -cz -f$(DISTFILE) -T-)
360 endif # LEGACY_OLD_MAKEFILE