Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 1 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 PKG_CONFIG ?= pkg-config
40 INCLUDE =
41 SBIN = $(BUILD_ROOT)/sbin
42 MANDIR = usr/man
43 MAN = $(BUILD_ROOT)/$(MANDIR)/man8
44 INIT = $(BUILD_ROOT)/etc/rc.d/init.d
45 MKDIR = mkdir
46 INSTALL = install
47 STATIC_LIBS = libipvs/libipvs.a
48
49 ifeq "${ARCH}" "sparc64"
50 CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
51 else
52 CFLAGS = -Wall -Wunused -Wstrict-prototypes -g
53 endif
54
55
56 #####################################
57 # No servicable parts below this line
58
59 RPMBUILD = $(shell \
60 if [ -x /usr/bin/rpmbuild ]; then \
61 echo "/usr/bin/rpmbuild"; \
62 else \
63 echo "/bin/rpm"; \
64 fi )
65
66 OBJS = ipvsadm.o config_stream.o dynamic_array.o
67 LIBS = -lpopt
68 ifneq (0,$(HAVE_NL))
69 LIBS += $(shell \
70 if which $(PKG_CONFIG) > /dev/null 2>&1; then \
71 if $(PKG_CONFIG) --libs libnl-genl-3.0 2> /dev/null; then :;\
72 elif $(PKG_CONFIG) --libs libnl-2.0 2> /dev/null; then :;\
73 elif $(PKG_CONFIG) --libs libnl-1 2> /dev/null; then :;\
74 fi; \
75 else echo "-lnl"; fi)
76 endif
77 DEFINES = -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \
78 -DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE)
79 DEFINES += $(shell if [ ! -f ../ip_vs.h ]; then \
80 echo "-DHAVE_NET_IP_VS_H"; fi;)
81
82
83 .PHONY = all clean install dist distclean rpm rpms
84
85 all: libs ipvsadm
86
87 libs:
88 make -C libipvs
89
90 ipvsadm: $(OBJS) $(STATIC_LIBS)
91 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
92
93 install: all
94 if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
95 $(INSTALL) -m 0755 ipvsadm $(SBIN)
96 $(INSTALL) -m 0755 ipvsadm-save $(SBIN)
97 $(INSTALL) -m 0755 ipvsadm-restore $(SBIN)
98 [ -d $(MAN) ] || $(MKDIR) -p $(MAN)
99 $(INSTALL) -m 0644 ipvsadm.8 $(MAN)
100 $(INSTALL) -m 0644 ipvsadm-save.8 $(MAN)
101 $(INSTALL) -m 0644 ipvsadm-restore.8 $(MAN)
102 [ -d $(INIT) ] || $(MKDIR) -p $(INIT)
103 $(INSTALL) -m 0755 ipvsadm.sh $(INIT)/ipvsadm
104
105 clean:
106 rm -f ipvsadm $(NAME).spec $(NAME)-$(VERSION).tar.gz
107 rm -rf debian/tmp
108 find . -name '*.[ao]' -o -name "*~" -o -name "*.orig" \
109 -o -name "*.rej" -o -name core | xargs rm -f
110 make -C libipvs clean
111
112 distclean: clean
113
114 dist: distclean
115 sed -e "s/@@VERSION@@/$(VERSION)/g" \
116 -e "s/@@RELEASE@@/$(RELEASE)/g" \
117 < ipvsadm.spec.in > ipvsadm.spec
118 rm -f $(NAME)-$(VERSION)
119 ln -s . $(NAME)-$(VERSION)
120 tar czvf $(NAME)-$(VERSION).tar.gz \
121 --exclude CVS --exclude .svn --exclude TAGS \
122 --exclude $(NAME)-$(VERSION)/$(NAME)-$(VERSION) \
123 --exclude $(NAME)-$(VERSION).tar.gz \
124 $(NAME)-$(VERSION)/*
125 rm -f $(NAME)-$(VERSION)
126
127 rpms: dist
128 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
129 cp $(NAME).spec $(RPMSPECDIR)/
130 $(RPMBUILD) -ba $(RPMSPECDIR)/$(NAME).spec
131
132 srpm: dist
133 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
134 cp $(NAME).spec $(RPMSPECDIR)/
135 $(RPMBUILD) -bs $(RPMSPECDIR)/$(NAME).spec
136
137 deb: debs
138
139 debs:
140 dpkg-buildpackage
141
142 %.o: %.c
143 $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<