Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 4 — not the installed (fully patched) source.
4 Debian patches touch this file
1 #
2 # ipvsadm - IP Virtual Server ADMinistration program
3 # for IPVS NetFilter Module in kernel 2.4
4 #
5 # Version: $Id$
6 #
7 # Authors: Wensong Zhang <[email protected]>
8 # Peter Kese <[email protected]>
9 #
10 # This file:
11 #
12 # ChangeLog
13 #
14 # Wensong : Modified the Makefile and the spec files so
15 # : that rpms can be created with ipvsadm alone
16 # P.Copeland : Modified the Makefile and the spec files so
17 # : that it is possible to create rpms on the fly
18 # : using 'make rpms'
19 # : Also added NAME, VERSION and RELEASE numbers to
20 # : the Makefile
21 # Horms : Updated to add config_stream.c dynamic_array.c
22 # : Added autodetection of libpot
23 # : Added BUILD_ROOT support
24 # Wensong : Changed the OBJS according to detection
25 # Ratz : Fixed to use the correct CFLAGS on sparc64
26 #
27
28 NAME = ipvsadm
29 VERSION = $(shell cat VERSION)
30 RELEASE = 1
31 SCHEDULERS = "$(shell cat SCHEDULERS)"
32 PE_LIST = "$(shell cat PERSISTENCE_ENGINES)"
33 PROGROOT = $(shell basename `pwd`)
34 ARCH = $(shell uname -m)
35 RPMSOURCEDIR = $(shell rpm --eval '%_sourcedir')
36 RPMSPECDIR = $(shell rpm --eval '%_specdir')
37
38 CC = gcc
39 INCLUDE =
40 SBIN = $(BUILD_ROOT)/sbin
41 MANDIR = usr/man
42 MAN = $(BUILD_ROOT)/$(MANDIR)/man8
43 INIT = $(BUILD_ROOT)/etc/rc.d/init.d
44 MKDIR = mkdir
45 INSTALL = install
46 STATIC_LIBS = libipvs/libipvs.a
47
48 ifeq "${ARCH}" "sparc64"
49 CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
50 else
51 CFLAGS = -Wall -Wunused -Wstrict-prototypes -g
52 endif
53
54
55 #####################################
56 # No servicable parts below this line
57
58 RPMBUILD = $(shell \
59 if [ -x /usr/bin/rpmbuild ]; then \
60 echo "/usr/bin/rpmbuild"; \
61 else \
62 echo "/bin/rpm"; \
63 fi )
64
65 OBJS = ipvsadm.o config_stream.o dynamic_array.o
66 LIBS = -lpopt
67 ifneq (0,$(HAVE_NL))
68 LIBS += $(shell \
69 if which pkg-config > /dev/null 2>&1; then \
70 if pkg-config --libs libnl-genl-3.0 2> /dev/null; then :;\
71 elif pkg-config --libs libnl-2.0 2> /dev/null; then :;\
72 elif pkg-config --libs libnl-1 2> /dev/null; then :;\
73 fi; \
74 else echo "-lnl"; fi)
75 endif
76 DEFINES = -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \
77 -DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE)
78 DEFINES += $(shell if [ ! -f ../ip_vs.h ]; then \
79 echo "-DHAVE_NET_IP_VS_H"; fi;)
80
81
82 .PHONY = all clean install dist distclean rpm rpms
83
84 all: libs ipvsadm
85
86 libs:
87 make -C libipvs
88
89 ipvsadm: $(OBJS) $(STATIC_LIBS)
90 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
91
92 install: all
93 if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
94 $(INSTALL) -m 0755 ipvsadm $(SBIN)
95 $(INSTALL) -m 0755 ipvsadm-save $(SBIN)
96 $(INSTALL) -m 0755 ipvsadm-restore $(SBIN)
97 [ -d $(MAN) ] || $(MKDIR) -p $(MAN)
98 $(INSTALL) -m 0644 ipvsadm.8 $(MAN)
99 $(INSTALL) -m 0644 ipvsadm-save.8 $(MAN)
100 $(INSTALL) -m 0644 ipvsadm-restore.8 $(MAN)
101 [ -d $(INIT) ] || $(MKDIR) -p $(INIT)
102 $(INSTALL) -m 0755 ipvsadm.sh $(INIT)/ipvsadm
103
104 clean:
105 rm -f ipvsadm $(NAME).spec $(NAME)-$(VERSION).tar.gz
106 rm -rf debian/tmp
107 find . -name '*.[ao]' -o -name "*~" -o -name "*.orig" \
108 -o -name "*.rej" -o -name core | xargs rm -f
109 make -C libipvs clean
110
111 distclean: clean
112
113 dist: distclean
114 sed -e "s/@@VERSION@@/$(VERSION)/g" \
115 -e "s/@@RELEASE@@/$(RELEASE)/g" \
116 < ipvsadm.spec.in > ipvsadm.spec
117 rm -f $(NAME)-$(VERSION)
118 ln -s . $(NAME)-$(VERSION)
119 tar czvf $(NAME)-$(VERSION).tar.gz \
120 --exclude CVS --exclude .svn --exclude TAGS \
121 --exclude $(NAME)-$(VERSION)/$(NAME)-$(VERSION) \
122 --exclude $(NAME)-$(VERSION).tar.gz \
123 $(NAME)-$(VERSION)/*
124 rm -f $(NAME)-$(VERSION)
125
126 rpms: dist
127 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
128 cp $(NAME).spec $(RPMSPECDIR)/
129 $(RPMBUILD) -ba $(RPMSPECDIR)/$(NAME).spec
130
131 srpm: dist
132 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
133 cp $(NAME).spec $(RPMSPECDIR)/
134 $(RPMBUILD) -bs $(RPMSPECDIR)/$(NAME).spec
135
136 deb: debs
137
138 debs:
139 dpkg-buildpackage
140
141 %.o: %.c
142 $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<