]> granicus.if.org Git - linux-pam/blob - libpam_misc/Makefile
Initial revision
[linux-pam] / libpam_misc / Makefile
1 # $Id$
2 #
3
4 dummy:
5         @echo "*** This is not a top-level Makefile!"
6
7 # ///////////////////////////////////////////////////////////////////
8
9 # uncomment if you wnat libpam_misc to be made as a dynamic library
10 # AGM has had some segfaulting from libdl when I did this. I have not
11 # investigated the cause...
12
13 MAKE_DYNAMIC=yes
14
15 ifeq ($(DEBUG_REL),yes)
16  LIBNAME=pamd_misc
17 else
18  LIBNAME=pam_misc
19 endif
20 LIBMAJOR=$(MAJOR_REL)
21 LIBMINOR=$(MINOR_REL)
22
23 FILES=misc_conv help_env
24
25 #
26 # Probably no need to alter anything below here.
27 #
28
29 # build dynamic library names
30
31 LIBDYNAMIC=lib$(LIBNAME).$(DYNTYPE)
32 LIBDYNMAJ=$(LIBDYNAMIC).$(LIBMAJOR)
33 LIBDYNMIN=$(LIBDYNMAJ).$(LIBMINOR)
34
35 # static library name
36
37 LIBSTATIC = lib$(LIBNAME).a
38
39 # sources and object files
40
41 LIBSRC = $(addsuffix .c,$(FILES))
42 LIBOBJ = $(addsuffix .o,$(FILES))
43
44 # rules
45
46 all: $(LIBSTATIC) $(LIBDYNAMIC)
47
48 $(LIBDYNAMIC): $(LIBOBJ)
49 ifdef MAKE_DYNAMIC
50     ifeq ($(USESONAME),yes)
51         $(LD_L) $(SOSWITCH) $(LIBDYNMAJ) -o $@ $(LIBOBJ) $(LINKLIBS)
52     else
53         $(LD_L) -o $@ $(LIBOBJ)
54     endif
55     ifeq ($(NEEDSONAME),yes)
56         rm -f $(LIBDYNMIN)
57         ln -s $(LIBDYNAMIC) $(LIBDYNMAJ)
58         rm -f $(LIBDYNMAJ)
59         ln -s $(LIBDYNAMIC) $(LIBDYNMIN)
60     endif
61 endif
62
63 $(LIBSTATIC): $(LIBOBJ)
64         $(AR) $@ $(LIBOBJ)
65         $(RANLIB) $@
66
67 install: all
68         $(MKDIR) $(FAKEROOT)$(INCLUDED)
69         $(INSTALL) -m 644 ./pam_misc.h $(FAKEROOT)$(INCLUDED)
70 ifdef MAKE_DYNAMIC
71         $(INSTALL) -m $(SHLIBMODE) $(LIBDYNAMIC) $(FAKEROOT)$(LIBDIR)/$(LIBDYNMIN)
72         $(LDCONFIG)
73   ifneq ($(DYNTYPE),"sl")
74         ( cd $(FAKEROOT)$(LIBDIR) ; ln -sf $(LIBDYNMAJ) $(LIBDYNAMIC) )
75   endif
76 endif
77         $(INSTALL) -m 644 $(LIBSTATIC) $(FAKEROOT)$(LIBDIR)
78
79 clean:
80         rm -f *.so *.a core a.out *~
81
82 remove:
83         rm -f $(FAKEROOT)$(INCLUDED)/pam_misc.h
84         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC).*
85         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBDYNAMIC)
86         $(LDCONFIG)
87         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBSTATIC)
88         rm -f $(FAKEROOT)$(INCLUDED)/chk_malloc.h
89
90 .c.o:
91         $(CC) -c $(DEFS) $(CFLAGS) $<
92
93 extraclean:
94         @$(MAKE) clean
95         rm -f *.o *.bak
96