Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 3 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 DEFAULT_CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
51 else
52 DEFAULT_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) $(DEFAULT_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
92
93 $(STATIC_LIBS): libs
94
95 install: all
96 if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
97 $(INSTALL) -m 0755 ipvsadm $(SBIN)
98 $(INSTALL) -m 0755 ipvsadm-save $(SBIN)
99 $(INSTALL) -m 0755 ipvsadm-restore $(SBIN)
100 [ -d $(MAN) ] || $(MKDIR) -p $(MAN)
101 $(INSTALL) -m 0644 ipvsadm.8 $(MAN)
102 $(INSTALL) -m 0644 ipvsadm-save.8 $(MAN)
103 $(INSTALL) -m 0644 ipvsadm-restore.8 $(MAN)
104 [ -d $(INIT) ] || $(MKDIR) -p $(INIT)
105 $(INSTALL) -m 0755 ipvsadm.sh $(INIT)/ipvsadm
106
107 clean:
108 rm -f ipvsadm $(NAME).spec $(NAME)-$(VERSION).tar.gz
109 rm -rf debian/tmp
110 find . -name '*.[ao]' -o -name "*~" -o -name "*.orig" \
111 -o -name "*.rej" -o -name core | xargs rm -f
112 make -C libipvs clean
113
114 distclean: clean
115
116 dist: distclean
117 sed -e "s/@@VERSION@@/$(VERSION)/g" \
118 -e "s/@@RELEASE@@/$(RELEASE)/g" \
119 < ipvsadm.spec.in > ipvsadm.spec
120 rm -f $(NAME)-$(VERSION)
121 ln -s . $(NAME)-$(VERSION)
122 tar czvf $(NAME)-$(VERSION).tar.gz \
123 --exclude CVS --exclude .svn --exclude TAGS \
124 --exclude $(NAME)-$(VERSION)/$(NAME)-$(VERSION) \
125 --exclude $(NAME)-$(VERSION).tar.gz \
126 $(NAME)-$(VERSION)/*
127 rm -f $(NAME)-$(VERSION)
128
129 rpms: dist
130 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
131 cp $(NAME).spec $(RPMSPECDIR)/
132 $(RPMBUILD) -ba $(RPMSPECDIR)/$(NAME).spec
133
134 srpm: dist
135 cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
136 cp $(NAME).spec $(RPMSPECDIR)/
137 $(RPMBUILD) -bs $(RPMSPECDIR)/$(NAME).spec
138
139 deb: debs
140
141 debs:
142 dpkg-buildpackage
143
144 %.o: %.c
145 $(CC) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDE) $(DEFINES) $(CPPFLAGS) -c -o $@ $<