Initial import from FreeBSD RELENG_4:
[games.git] / contrib / libpam / libpam_misc / Makefile
1 # $FreeBSD: src/contrib/libpam/libpam_misc/Makefile,v 1.1.1.1.6.2 2001/06/11 15:28:15 markm Exp $
2 # $Header: /home/morgan/pam/Linux-PAM-0.57/libpam_misc/RCS/Makefile,v 1.10 1997/04/05 07:00:18 morgan Exp $
3 #
4 # $Log: Makefile,v $
5 # Revision 1.10  1997/04/05 07:00:18  morgan
6 # fakeroot
7 #
8 # Revision 1.9  1997/02/15 15:46:56  morgan
9 # inherit major and minor numbers from top level
10 #
11 # Revision 1.8  1997/01/04 20:20:11  morgan
12 # update for .55 and make -> $(MAKE)
13 #
14 # Revision 1.7  1996/12/01 03:28:11  morgan
15 # update for 0.54
16 #
17
18 dummy:
19         @echo "*** This is not a top-level Makefile!"
20
21 # ///////////////////////////////////////////////////////////////////
22
23 # uncomment if you wnat libpam_misc to be made as a dynamic library
24 # AGM has had some segfaulting from libdl when I did this. I have not
25 # investigated the cause...
26
27 MAKE_DYNAMIC=yes
28
29 ifeq ($(DEBUG_REL),yes)
30  LIBNAME=pamd_misc
31 else
32  LIBNAME=pam_misc
33 endif
34 LIBMAJOR=$(MAJOR_REL)
35 LIBMINOR=$(MINOR_REL)
36
37 FILES=misc_conv help_env
38
39 #
40 # Probably no need to alter anything below here.
41 #
42
43 # build dynamic library names
44
45 LIBDYNAMIC=lib$(LIBNAME).$(DYNTYPE)
46 LIBDYNMAJ=$(LIBDYNAMIC).$(LIBMAJOR)
47 LIBDYNMIN=$(LIBDYNMAJ).$(LIBMINOR)
48
49 # static library name
50
51 LIBSTATIC = lib$(LIBNAME).a
52
53 # sources and object files
54
55 LIBSRC = $(addsuffix .c,$(FILES))
56 LIBOBJ = $(addsuffix .o,$(FILES))
57
58 # rules
59
60 all: $(LIBSTATIC) $(LIBDYNAMIC)
61
62 $(LIBDYNAMIC): $(LIBOBJ)
63 ifdef MAKE_DYNAMIC
64     ifeq ($(USESONAME),yes)
65         $(LD_L) $(SOSWITCH) $(LIBDYNMAJ) -o $@ $(LIBOBJ)
66     else
67         $(LD_L) -o $@ $(LIBOBJ)
68     endif
69     ifeq ($(NEEDSONAME),yes)
70         rm -f $(LIBDYNMIN)
71         ln -s $(LIBDYNAMIC) $(LIBDYNMAJ)
72         rm -f $(LIBDYNMAJ)
73         ln -s $(LIBDYNAMIC) $(LIBDYNMIN)
74     endif
75 endif
76
77 $(LIBSTATIC): $(LIBOBJ)
78         $(AR) $@ $(LIBOBJ)
79         $(RANLIB) $@
80
81 install: all
82         $(MKDIR) $(FAKEROOT)$(INCLUDED)
83         $(INSTALL) -m 644 ./pam_misc.h $(FAKEROOT)$(INCLUDED)
84 ifdef MAKE_DYNAMIC
85         $(INSTALL) -m $(SHLIBMODE) $(LIBDYNAMIC) $(FAKEROOT)$(LIBDIR)/$(LIBDYNMIN)
86         $(LDCONFIG)
87   ifneq ($(DYNTYPE),"sl")
88         ( cd $(FAKEROOT)$(LIBDIR) ; ln -sf $(LIBDYNMAJ) $(LIBDYNAMIC) )
89   endif
90 endif
91         $(INSTALL) -m 644 $(LIBSTATIC) $(FAKEROOT)$(LIBDIR)
92
93 clean:
94         rm -f *.so *.a core a.out *~
95
96 remove:
97         rm -f $(FAKEROOT)$(INCLUDED)/pam_misc.h
98         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC).*
99         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC)
100         $(LDCONFIG)
101         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBSTATIC)
102         rm -f $(FAKEROOT)$(INCLUDED)/chk_malloc.h
103
104 .c.o:
105         $(CC) -c $(DEFS) $(CFLAGS) $<
106
107 extraclean:
108         @$(MAKE) clean
109         rm -f *.o *.bak
110