File: Makefile

package info (click to toggle)
resmgr 1.0-2sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 308 kB
  • ctags: 313
  • sloc: ansic: 3,165; sh: 556; makefile: 109
file content (73 lines) | stat: -rw-r--r-- 1,714 bytes parent folder | download
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

VERSION	= 1.0
CFLAGS	= -Wall -g
SBINDIR	= $(DESTDIR)/sbin
LIBDIR	= $(DESTDIR)/lib
INCDIR	= $(DESTDIR)/usr/include
MANDIR	= $(DESTDIR)/usr/share/man
PAMDIR	= $(DESTDIR)/lib/security
ETCDIR	= $(DESTDIR)/etc

SRV	= resmgrd
SRVOBJS	= $(addprefix .objs/,main.o session.o \
	  class.o acl.o config.o svc.o \
	  family.o file.o scsi.o usb.o paride.o \
	  utils.o)

CLT	= resmgr
CLTOBJS	= $(addprefix .objs/,resmgr.o)

PAM	= pam_resmgr.so
PAMOBJS	= $(addprefix .lobjs/,pam_resmgr.o)

LIBBASE	= libresmgr.so
LIB	= $(LIBBASE).$(VERSION)
LIBOBJS	= $(addprefix .lobjs/,conn.o client.o glob.o)

ALL	= $(SRV) $(CLT) $(LIB) $(PAM) tester

all:	$(ALL)

install: $(ALL)
	mkdir -p $(SBINDIR) $(LIBDIR) $(MANDIR)/man{1,3,5,8} \
		$(ETCDIR) $(PAMDIR) $(INCDIR)
	install -m 555 $(LIB) $(LIBDIR)
	install -m 555 $(PAM) $(PAMDIR)
	if [ ! -f $(ETCDIR)/resmgr.conf ]; then \
		install -m 644 etc/resmgr.conf $(ETCDIR); \
	fi
	install -m 444 resmgr.h $(INCDIR)
	install -m 555 -s $(CLT) $(SRV) $(SBINDIR)
	for x in 1 3 5 8; do \
		install -m 444 doc/*.$$x $(MANDIR)/man$$x; \
	done

clean distclean:
	rm -rf $(ALL) $(LIBBASE) .objs .lobjs

$(SRV):	$(SRVOBJS) $(LIB)
	$(CC) -o $@ $(SRVOBJS) -L. -lresmgr

$(CLT):	$(CLTOBJS) $(LIB)
	$(CC) -o $@ $(CLTOBJS) -L. -lresmgr

$(LIB): $(LIBOBJS)
	$(CC) -shared -Wl,-soname,$(notdir $(LIB)) -o $@ $(LIBOBJS)
	ln -sf $(LIB) $(LIBBASE)

$(PAM): $(PAMOBJS) $(LIB)
	$(CC) -shared -o $@ $(PAMOBJS) -L. -lresmgr

tester: .objs/tester.o $(LIB)
	$(CC) -o $@ .objs/tester.o -L. -lresmgr

acltest: acl.c .objs/utils.o
	$(CC) $(CFLAGS) -o $@ -DTEST acl.c .objs/utils.o

.objs/%.o: %.c
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -o $@ -c $< 

.lobjs/%.o: %.c
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -fPIC -o $@ -c $<