File: Makefile

package info (click to toggle)
pwdb 0.54preD-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 644 kB
  • ctags: 797
  • sloc: ansic: 8,459; makefile: 346; sh: 204
file content (119 lines) | stat: -rw-r--r-- 3,995 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# The libpwdb Makefile
#
# this compiles only as a static lib, so all functions withing this lib
# will be statically linked in the modules which makes use of it.
#

dummy:
	@echo "*** This is not a top-level Makefile!"

# ///////////////////////////////////////////////////////////////////

srcdir = .
vpath %.c $(srcdir)
vpath %.h $(srcdir)

LIBNAME = pwdb
MAJOR=.0
MINOR=.54

HEADERS	= pwdb/pwdb_public.h pwdb/pwdb_config.h pwdb/pwdb_module.h

CFLAGS+=-I. -I$(srcdir)/ -I$(srcdir)/../include 	# needed for generic interface compilation
		# if header files are not installed (CG)

CFLAGS+=# -DDEBUG

#
# Probably no need to alter anything below here.
#

LIBDYNAME=lib$(LIBNAME).so
LIBDYNMAJ=$(LIBDYNAME)$(MAJOR)
LIBDYNMIN=$(LIBDYNMAJ)$(MINOR)

LIBSTATIC = lib$(LIBNAME).a

DIRS= common unix shadow nis radius pwdb posix

# sources and object files

LIBSRC = $(srcdir)/common/commonio.c $(srcdir)/common/grcommon.c \
	$(srcdir)/common/lockpw.c $(srcdir)/common/misc.c \
	$(srcdir)/unix/group.c $(srcdir)/unix/passwd.c \
	$(srcdir)/unix/pwio.c $(srcdir)/unix/groupio.c \
	$(srcdir)/shadow/gshadow.c $(srcdir)/shadow/shadow.c \
	$(srcdir)/shadow/shadowio.c $(srcdir)/shadow/sgroupio.c \
	$(srcdir)/nis/group.c $(srcdir)/nis/password.c \
	$(srcdir)/radius/radius.c $(srcdir)/radius/util.c \
	$(srcdir)/radius/md5.c $(srcdir)/radius/helpfunc.c $(srcdir)/radius/dict.c \
	$(srcdir)/pwdb/pwdb_error.c $(srcdir)/pwdb/pwdb_helper.c $(srcdir)/pwdb/pwdb_locate.c \
	$(srcdir)/pwdb/pwdb_module.c $(srcdir)/pwdb/pwdb_start.c \
	$(srcdir)/posix/pwd.c posix/grp.c $(srcdir)/posix/getlogin.c $(srcdir)/posix/undefined
LIBOBJ = common/commonio.o common/grcommon.o common/lockpw.o common/misc.o \
	unix/group.o unix/passwd.o unix/pwio.o unix/groupio.o \
	shadow/gshadow.o shadow/shadow.o shadow/shadowio.o shadow/sgroupio.o \
	nis/group.o nis/password.o \
	radius/radius.o radius/util.o radius/md5.o radius/helpfunc.o radius/dict.o \
	pwdb/pwdb_error.o pwdb/pwdb_helper.o pwdb/pwdb_locate.o pwdb/pwdb_module.o pwdb/pwdb_start.o \
	posix/pwd.o posix/grp.o posix/getlogin.o posix/undefined.o

# rules
%.o : %.c $(HEADERS)
	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@

all: directories $(LIBSTATIC) $(LIBDYNAME)

directories: 
	@for i in $(DIRS) ; do \
		test -d $$i || mkdir $$i ; \
	done

$(LIBDYNAME): $(LIBOBJ)
	$(CC) -shared -o $(LIBDYNAME) -Wl,-soname,$(LIBDYNMAJ) $(LIBOBJ) -lc

$(LIBSTATIC): $(LIBOBJ)
	$(AR) $@ $(LIBOBJ)
	$(RANLIB) $@

install: all
	$(MKDIR) $(INCLUDED)
	$(INSTALL) -m 644 $(srcdir)/pwdb/pwdb_public.h $(INCLUDED)
	$(INSTALL) -m 644 $(srcdir)/./pwdb_map.h $(INCLUDED)
	$(INSTALL) -m 644 $(srcdir)/unix/public.h $(INCLUDED)/pwdb_unix.h
	$(INSTALL) -m 644 $(srcdir)/shadow/public.h $(INCLUDED)/pwdb_shadow.h
	$(INSTALL) -m 644 $(srcdir)/common/public.h $(INCLUDED)/pwdb_common.h
	$(INSTALL) -m 644 $(srcdir)/radius/public.h $(INCLUDED)/pwdb_radius.h
	$(INSTALL) -m 644 $(srcdir)/radius.h $(INCLUDED)/radius.h
	$(INSTALL) -m 644 $(srcdir)/_pwdb_macros.h $(INCLUDED)/_pwdb_macros.h
	$(INSTALL) -m 644 $(LIBDYNAME) $(LIBDIR)/$(LIBDYNMIN)
	#$(LDCONFIG)
	( cd $(LIBDIR) ; ln -sf $(LIBDYNMAJ) $(LIBDYNAME) )
	( cd $(LIBDIR) ; ln -sf $(LIBDYNMIN) $(LIBDYNMAJ) )
	$(INSTALL) -m 644 $(LIBSTATIC) $(LIBDIR)

clean:
	@echo Cleaning up...
	@rm -vf *.so *.a core a.out `find . -name "*.o" -print` `find . -name "*~" -print`
	make -C $(srcdir)/pwdb/interface clean

remove:
	rm -f $(INCLUDED)/pam_public.h
	rm -f $(INCLUDED)/pam_map.h
	rm -f $(LIBDIR)/$(LIBDYNAME)*
	#$(LDCONFIG)
	rm -f $(LIBDIR)/$(LIBSTATIC)

.c.o:
	$(CC) -c $(DEFS) $(CFLAGS) $<

extraclean: clean

# hardcoded dependencies
pwdb/pwdb_module.o: pwdb/pwdb_module.c pwdb/helpers.c \
	pwdb/interface/unix.c pwdb/interface/shadow.c \
	pwdb/interface/radius.c pwdb/interface/nis.c \
	pwdb/interface/unix/user.c pwdb/interface/unix/group.c \
	pwdb/interface/shadow/user.c pwdb/interface/shadow/group.c \
	pwdb/interface/radius/user.c pwdb/interface/radius/group.c \
	pwdb/interface/nis/user.c pwdb/interface/nis/group.c