-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
84 lines (64 loc) · 2.17 KB
/
GNUmakefile
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
-include mk/$(shell uname -s).mk
project = ubolt
prefix = /
libdir = $(prefix)/lib
lib64dir = $(prefix)/lib64
pamdir = $(prefix)/lib/security
mandir = $(prefix)/usr/share/man/man8
nss_targets = nss_identity nss_filter
pam_targets = pam_provision pam_globus
targets = $(nss_targets) $(pam_targets)
# If compiled with -DDEBUG, then applications will print debugging
# information to stdout when NSSDEBUG is set in the environment.
#CFLAGS += -DDEBUG -g
# -fPIC is not required on all platforms, but is on some; and it doesn't
# appear to hurt.
CFLAGS += -fPIC $(cflags)
all: $(targets)
$(nss_targets):
@ $(MAKE) nsslink manual name=$@
pam_provision:
@ $(MAKE) pamlink manual name=$@
pam_globus: globus.o
@ $(MAKE) pamlink manual name=$@ PAM_LIBS="globus.o -lcurl"
$(patsubst %,%.c,$(targets)): version.o
.PHONY: nsslink pamlink install clean release
nsslink: $(name).o util.o version.o
$(SO_LD) -o lib$(name).so.2 $(name).o version.o
pamlink: $(name).o util.o version.o
$(SO_LD) -o $(name).so $(name).o version.o util.o $(PAM_LIBS)
manual: doc/$(name).txt
-rst2man doc/$(name).txt >doc/$(name).8.tmp
mv -f doc/$(name).8.tmp doc/$(name).8
version.c:
hg parents --template='static char version[] = "ubolt version {rev} {node|short} ({latesttag}+{latesttagdistance})";\n' >version.c
version.o: version.c
util.o: util.c
install:
arch=`uname -m`; \
if [ "$$arch" = "x86_64" ]; then \
mkdir -p $(lib64dir) $(pamdir); \
cp -f $(patsubst %,lib%.so.2,$(nss_targets)) $(lib64dir); \
cp -f $(patsubst %,%.so,$(pam_targets)) $(pamdir); \
else \
mkdir -p $(libdir) $(pamdir); \
cp -f $(patsubst %,lib%.so.2,$(targets)) $(libdir); \
cp -f $(patsubst %,%.so,$(pam_targets)) $(pamdir); \
fi
mkdir -p $(mandir)
cp -f $(patsubst %,doc/%.8,$(targets)) $(mandir)
clean:
rm -f $(patsubst %,%.o,$(targets)) \
$(patsubst %,lib%.so.2,$(nss_targets)) \
$(patsubst %,%.so,$(pam_targets)) \
$(patsubst %,doc/%.8,$(targets)) \
$(patsubst %,doc/%.8,$(targets)) \
globus.o util.o version.c version.o
release:
rev=`hg parents --template '{rev}'`; \
dir=$(project)-$${rev}; \
rm -rf "$$dir"; \
hg archive "$$dir"; \
(cd "$$dir"; make version.c); \
tar czf "$$dir.tar.gz" "$$dir"; \
rm -rf "$$dir"