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