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