]> granicus.if.org Git - linux-pam/blob - libpamc/Makefile
Initial revision
[linux-pam] / libpamc / Makefile
1 #
2 # $Id$
3 #
4
5 # lots of debugging information goes to /tmp/pam-debug.log
6 #MOREFLAGS += -D"DEBUG"
7
8 ifeq ($(DEBUG_REL),yes)
9  LIBNAME=libpamcd
10 else
11  LIBNAME=libpamc
12 endif
13 VERSION=.$(MAJOR_REL)
14 MODIFICATION=.$(MINOR_REL)
15
16 # ---------------------------------------------
17
18 dummy:
19         @echo "*** This is not a top-level Makefile!"
20
21 # ---------------------------------------------
22
23 CFLAGS += $(DYNAMIC) $(STATIC) $(MOREFLAGS)
24
25 # dynamic library names
26
27 LIBPAMC = $(LIBNAME).$(DYNTYPE)
28 LIBPAMCNAME = $(LIBPAMC)$(VERSION)
29 LIBPAMCFULL = $(LIBPAMCNAME)$(MODIFICATION)
30
31 # static library name
32
33 LIBPAMCSTATIC = $(LIBNAME).a
34
35 LIBOBJECTS = pamc_client.o pamc_converse.o pamc_load.o
36
37 ifdef DYNAMIC_LIBPAM
38 DLIBOBJECTS = $(addprefix dynamic/,$(LIBOBJECTS))
39 endif
40
41 ifdef STATIC_LIBPAM
42 SLIBOBJECTS = $(addprefix static/,$(LIBOBJECTS))
43 endif
44
45 # ---------------------------------------------
46 ## rules
47
48 all: dirs $(LIBPAMC) $(LIBPAMCSTATIC)
49
50 dirs:
51 ifdef DYNAMIC_LIBPAM
52         mkdir -p dynamic
53 endif
54 ifdef STATIC_LIBPAM
55         mkdir -p static
56 endif
57
58 dynamic/%.o : %.c
59         $(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
60
61 static/%.o : %.c
62         $(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
63
64 $(LIBPAMC): $(DLIBOBJECTS)
65 ifdef DYNAMIC_LIBPAM
66     ifeq ($(USESONAME),yes)
67         $(LD_L) $(SOSWITCH) $(LIBPAMCNAME) -o $@ $(DLIBOBJECTS) $(MODULES) $(LINKLIBS)
68     else
69         $(LD_L) -o $@ $(DLIBOBJECTS) $(MODULES)
70     endif
71     ifeq ($(NEEDSONAME),yes)
72         rm -f $(LIBPAMCFULL)
73         ln -s $(LIBPAMC) $(LIBPAMCFULL)
74         rm -f $(LIBPAMCNAME)
75         ln -s $(LIBPAMC) $(LIBPAMCNAME)
76     endif
77 endif
78
79 $(LIBPAMCSTATIC): $(SLIBOBJECTS)
80 ifdef STATIC_LIBPAM
81         $(AR) $@ $(SLIBOBJECTS) $(MODULES)
82         $(RANLIB) $@
83 endif
84
85 install: all
86         $(MKDIR) $(FAKEROOT)$(INCLUDED)
87         $(INSTALL) -m 644 include/security/pam_client.h $(FAKEROOT)$(INCLUDED)
88 ifdef DYNAMIC_LIBPAM
89         $(INSTALL) -m $(SHLIBMODE) $(LIBPAMC) $(FAKEROOT)$(LIBDIR)/$(LIBPAMCFULL)
90         $(LDCONFIG)
91   ifneq ($(DYNTYPE),"sl")
92         ( cd $(FAKEROOT)$(LIBDIR) ; rm -f $(LIBPAMC) ; ln -s $(LIBPAMCNAME) $(LIBPAMC) )
93   endif
94 endif
95 ifdef STATIC_LIBPAM
96         $(INSTALL) -m 644 $(LIBPAMCSTATIC) $(FAKEROOT)$(LIBDIR)
97 endif
98
99 remove:
100         rm -f $(FAKEROOT)$(INCLUDED)/pam_client.h
101         $(LDCONFIG)
102         rm -f $(FAKEROOT)$(LIBDIR)/$(LIBPAMCSTATIC)
103
104 clean:
105         rm -f a.out core *~ static/*.o dynamic/*.o
106
107 extraclean: clean
108         rm -f *.a *.out *.o *.so ./include/security/*~
109         if [ -d dynamic ]; then rmdir dynamic ; fi
110         if [ -d static ]; then rmdir static ; fi