Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / libpam / Makefile
1 ##
2 ## $Id: Makefile,v 1.31 1997/04/05 07:04:25 morgan Exp morgan $
3 ## $FreeBSD: src/contrib/libpam/Makefile,v 1.1.1.1.6.2 2001/06/11 15:28:09 markm Exp $
4 ##
5 ## $Log: Makefile,v $
6 ##
7 ##
8
9 # major and minor numbers of this release
10 MAJOR_REL=0
11 MINOR_REL=65
12 DEBUG_REL=no
13 #DEBUG_REL=yes
14
15 # this should be the name of this directory
16 RELNAME = Linux-PAM-$(MAJOR_REL).$(MINOR_REL)
17
18 # this is the name of the archive file
19 DISTFILE = $(RELNAME).tar.gz
20
21 # define this to indicate to subdirectories that they are part of the 
22 # full source tree.
23 FULL_LINUX_PAM_SOURCE_TREE=yes
24 export FULL_LINUX_PAM_SOURCE_TREE
25
26 DYNLOAD="dl"
27 DYNTYPE="so"
28
29 # Comment out either line to disable that type of linking for *modules only*
30 # Both at once is a legal configuration!
31 DYNAMIC=-DPAM_DYNAMIC
32 #STATIC=-DPAM_STATIC
33
34 # Comment out these lines to disable building dynamic/static libpam.*
35 DYNAMIC_LIBPAM=yes
36 #STATIC_LIBPAM=yes
37
38 # All combinations of the above four variable definitions are legal,
39 # however, not defining either dynamic or static modules and yet
40 # creating a some flavor of LIBPAM will make an authentication library
41 # that always fails!
42
43 # Here we indicate which libraries are present on the local system
44 # they control the building of some modules in this distribution
45 # Note, these definitions are all "export"ed below...
46
47 HAVE_PWDBLIB=no
48 HAVE_CRACKLIB=no
49 HAVE_AFSLIBS=no
50 HAVE_KRBLIBS=no
51
52 # NB. The following is the generic defines for compilation.
53 # They can be overridden in the default.defs file below
54 #
55 WARNINGS = -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
56         -Wpointer-arith -Wcast-qual -Wcast-align \
57         -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
58         -Wnested-externs -Winline -Wshadow -pedantic
59 PIC=-fPIC
60
61 # Mode to install shared libraries with
62 SHLIBMODE=644
63
64 #
65 # Conditional defines..
66 #
67
68 ifdef DYNAMIC
69 # need the dynamic library functions
70 LIBDL=-l$(DYNLOAD)
71 ifdef STATIC_LIBPAM
72 # needed because pam_xxx() fn's are now in statically linked library
73 RDYNAMIC = -rdynamic
74 endif
75 endif
76
77 # Here we include the defines for the preferred operating system
78 # these include things like CC, CFLAGS and destination directories 
79 # etc.. By default, this is a symbolic link to one of the .defs files
80 # the .../defs/ directory. Please take a moment to check that you are
81 # using the correct one.
82
83 include default.defs
84
85 # to turn on the fprintf(stderr, ..) debugging lines throughout the
86 # distribution uncomment this line
87 #EXTRAS += -DDEBUG
88
89 # For serious memory allocation tracing uncomment the following
90 #MEMORY_DEBUG=-DMEMORY_DEBUG
91
92 #######################################################################
93 # The pam_unix module in this file will not work on NIS based systems.#
94 #######################################################################
95
96 # ////////////////////////////////////////////////////
97 # // You should not modify anything below this line //
98 # ////////////////////////////////////////////////////
99
100 # the sub-directories to make things in
101
102 DIRS = modules libpam conf libpam_misc examples
103
104 #
105 # basic defines
106 #
107
108 INCLUDEDIR=-I$(shell pwd)/include
109 PAMLIB=-L$(shell pwd)/libpam
110 PAMMISCLIB=-L$(shell pwd)/libpam_misc
111 ifeq ($(DEBUG_REL),yes)
112  PAMLIB += -lpamd
113  PAMMISCLIB += -lpamd_misc
114 else
115  PAMLIB += -lpam
116  PAMMISCLIB += -lpam_misc
117 endif
118
119
120 # This is Linux-PAM and not a version from Sun etc..
121 # [Note, this does not describe the operating system you are using
122 # only that you are compiling the "Linux" (read FREE) implementation
123 # of Pluggable Authentication Modules.
124 EXTRAS += -DLINUX_PAM
125
126 #
127 # build composite defines
128 #
129
130 LOADLIBES = $(PAMLIB) $(RDYNAMIC) $(PAMMISCLIB) $(LIBDL) $(ULIBS)
131
132 CFLAGS += $(EXTRAS) $(MEMORY_DEBUG) $(WARNINGS) $(INCLUDEDIR) $(PIC)
133 ifneq ($(strip $(OS)),)
134 CFLAGS += -D$(OS)
135 endif
136 ifneq ($(strip $(ARCH)),)
137 CFLAGS += -D$(ARCH)
138 endif
139
140 #
141 # export the libraries-available info; the modules should know how
142 # to deal with this...
143 #
144 export HAVE_PWDBLIB             
145 export HAVE_CRACKLIB
146 export HAVE_AFSLIBS
147 export HAVE_KRBLIBS
148
149 #
150 # generic exports
151 #
152 export MAJOR_REL                # the major release of this distribution
153 export MINOR_REL                # the minor release of this distribution
154 export DEBUG_REL                # for installing a debugging version of PAM
155 export OS                       # operating system
156 export ARCH                     # architecture
157 export CC                       # the C compiler
158 export INSTALL                  # to do instalations with
159 export MKDIR                    # to ensure directories exist
160 export CFLAGS                   # CC flags used to compile everything
161 export LD_D                     # build a shared object file (module)
162 export LD_L                     # build a shared library (e.g. libpam)
163 export USESONAME                # does shlib link command require soname option
164 export SOSWITCH                 # shlib lib soname switch name
165 export NEEDSONAME               # does shared library link need versioned lib
166 export LD                       # build a generic library
167 export LDCONFIG                 # rebuild the shared libraries
168 export AR                       # build a static library
169 export RANLIB                   # reorder a static library
170 export LOADLIBES                # libraries needed for application linking
171 export PAMLIB                   # where to find the local libpam.xx file
172 export DYNTYPE                  # which suffix is used for libraries
173 export SHLIBMODE                # file mode for shared objects
174 #
175 # where to install things
176 #
177 export FAKEROOT                 # for package maintainers
178 #
179 export PREFIX                   # basic prefix for all other directories
180 export SUPLEMENTED              # where to store module helper binaries
181 export LIBDIR                   # where libpam and libpam_misc go
182 export SECUREDIR                # where the modules will be placed
183 export INCLUDED                 # where to store pam---.h files
184 export CONFIGED                 # where pam.conf and pam.d/ go
185 export SCONFIGED                # where modules' config files go
186
187 #
188 # Conditional exporting ( ... these go on for a while... )
189 #
190 ifdef DYNAMIC 
191 export DYNAMIC
192 endif
193 ifdef STATIC
194 export STATIC
195 endif
196 ifdef DYNAMIC_LIBPAM
197 export DYNAMIC_LIBPAM
198 endif
199 ifdef STATIC_LIBPAM
200 export STATIC_LIBPAM
201 endif
202 ifdef MEMORY_DEBUG
203 export MEMORY_DEBUG
204 endif
205
206 ##
207 ## the rules
208 ##
209
210 all: .freezemake
211         @for i in $(DIRS) ; do \
212                 $(MAKE) -C $$i all ; \
213                 if [ $$? -ne 0 ]; then break ; fi ; \
214         done
215
216 .freezemake:
217 # Do nothing
218
219 .old_freezemake: Makefile
220         @touch .freezemake
221         @echo "*WARNING*: If you are running a system that is dependent"
222         @echo "  on PAM to work. DO NOT make sterile NOR make remove."
223         @echo "  These options will delete the PAM files on your system"
224         @echo "  and make it unusable!"
225         @echo ""
226         @echo "If you are in any doubt, just do 'make all' (or just"
227         @echo "'make'). It is likely that this is the SAFEST thing to do...."
228         @exit 1
229
230 install:
231         @for i in $(DIRS) ; do \
232                 $(MAKE) -C $$i install ; \
233                 if [ $$? -ne 0 ]; then break ; fi ; \
234         done
235         install ./doc/man/*.3 $(PREFIX)/man/man3/
236         install ./doc/man/*.8 $(PREFIX)/man/man8/
237
238 sterile: .freezemake
239         @$(MAKE) remove
240         @$(MAKE) extraclean
241
242 remove: .freezemake
243         @for i in $(DIRS) ; do \
244                 $(MAKE) -C $$i remove ; \
245         done
246
247 clean:
248         @rm -f *~ core
249         @for i in $(DIRS) ; do \
250                 $(MAKE) -C $$i clean ; \
251         done
252
253 extraclean:
254         @for i in $(DIRS) doc; do \
255                 $(MAKE) -C $$i extraclean ; \
256         done
257
258 check:
259         @$(MAKE) -C conf check
260
261 RCScheck:
262         @$(MAKE) -C conf RCScheck
263
264 # this can be used to see what hasn't been check'd into RCS
265
266 open:
267         @find . \( -type f -a -perm 644 \) -print
268
269 release:
270         @egrep '^DEBUG\_REL\=yes' Makefile|grep -v grep > /dev/null ;\
271                 if [ $$? -eq 0 ]; then \
272                 echo "You should first set DEBUG_REL to no" ; exit 1 ; fi
273         $(MAKE) extraclean
274         rm -f .freezemake
275         touch .filelist .RCSlist
276         chmod 600 .filelist .RCSlist
277         cd .. ; find $(RELNAME) \! -type d -print | fgrep -v RCS | fgrep -v 'conf/.md5sum' > $(RELNAME)/.filelist
278         cd .. ; find $(RELNAME) -type f -print | fgrep RCS | fgrep -v 'conf/.RCSsum' > $(RELNAME)/.RCSlist
279         chmod 400 .filelist .RCSlist
280         $(MAKE) check
281         $(MAKE) RCScheck
282         (cat .filelist ; echo $(RELNAME)/conf/.md5sum) | (cd .. ; tar -cz -f$(DISTFILE) -T-)
283         (cat .RCSlist ; echo $(RELNAME)/conf/.RCSsum) | (cd .. ; tar -cz -fRCS+$(DISTFILE) -T-)