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