debuggers.hg

view tools/remus/imqebt/Makefile @ 20965:10a54ab63607

tools/remus: fix build in (symlinked) read-only source tree

Modifying source files should generally be avoided; if it is being
done, care should at least be taken to not attempt writes to read-only
files.

While at it, also force the whole ugly construct to fail if any of its
commands fails.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 10 09:19:16 2010 +0000 (2010-02-10)
parents 5b921ccbc8f9
children
line source
1 # ebtables Makefile (reworked for Remus IMQ control)
3 XEN_ROOT=../../..
4 include $(XEN_ROOT)/tools/Rules.mk
6 PROGNAME:=ebtables
7 PROGRELEASE:=1
8 PROGVERSION_:=2.0.9
9 PROGVERSION:=$(PROGVERSION_)-$(PROGRELEASE)
10 PROGDATE:=June\ 2009
12 ifeq ($(shell uname -m),sparc64)
13 CFLAGS+=-DEBT_MIN_ALIGN=8 -DKERNEL_64_USERSPACE_32
14 endif
16 include extensions/Makefile
18 OBJECTS2:=getethertype.o communication.o libebtc.o \
19 useful_functions.o ebtables.o
21 OBJECTS:=$(OBJECTS2) $(EXT_OBJS) $(EXT_LIBS)
23 KERNEL_INCLUDES?=include/
25 ETHERTYPESPATH?=$(ETCDIR)
26 ETHERTYPESFILE:=$(ETHERTYPESPATH)/ethertypes
28 PIPE_DIR?=/tmp/$(PROGNAME)-v$(PROGVERSION)
29 PIPE=$(PIPE_DIR)/ebtablesd_pipe
30 EBTD_CMDLINE_MAXLN?=2048
31 EBTD_ARGC_MAX?=50
33 PROGSPECS:=-DPROGVERSION=\"$(PROGVERSION)\" \
34 -DPROGNAME=\"$(PROGNAME)\" \
35 -DPROGDATE=\"$(PROGDATE)\" \
36 -D_PATH_ETHERTYPES=\"$(ETHERTYPESFILE)\" \
37 -DEBTD_ARGC_MAX=$(EBTD_ARGC_MAX) \
38 -DEBTD_CMDLINE_MAXLN=$(EBTD_CMDLINE_MAXLN)
40 # Uncomment for debugging (slower)
41 #PROGSPECS+=-DEBT_DEBUG
42 #CFLAGS+=-ggdb
44 PROGRAMS = imqebt
46 .PHONY: all
47 all: build
49 .PHONY: build
50 build: $(PROGRAMS)
52 # a little scripting for a static binary, making one for ebtables-restore
53 # should be completely analogous
54 imqebt: extensions/ebt_*.c extensions/ebtable_*.c ebtables.c communication.c ebtables-standalone.c getethertype.c libebtc.c useful_functions.c
55 set -e ; \
56 mv ebtables-standalone.c ebtables-standalone.c_ ; \
57 sed "s/ main(/ pseudomain(/" ebtables-standalone.c_ > ebtables-standalone.c ; \
58 printf "\nint main(int argc, char *argv[])\n{\n " >> ebtables-standalone.c ; \
59 mv include/ebtables_u.h include/ebtables_u.h_ ; \
60 cat include/ebtables_u.h_ >include/ebtables_u.h ; \
61 for arg in $(EXT_FUNC) \
62 ; do \
63 sed s/_init/_$${arg}_init/ extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \
64 mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \
65 printf "\t%s();\n" _$${arg}_init >> ebtables-standalone.c ; \
66 printf "extern void %s(void);\n" _$${arg}_init >> include/ebtables_u.h ; \
67 done ; \
68 for arg in $(EXT_TABLES) \
69 ; do \
70 sed s/_init/_t_$${arg}_init/ extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \
71 mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \
72 printf "\t%s();\n" _t_$${arg}_init >> ebtables-standalone.c ; \
73 printf "extern void %s(void);\n" _t_$${arg}_init >> include/ebtables_u.h ; \
74 done ; \
75 printf "\n\tpseudomain(argc, argv);\n\treturn 0;\n}\n" >> ebtables-standalone.c ;\
76 $(CC) $(CFLAGS) $(PROGSPECS) -o $@ $^ -I$(KERNEL_INCLUDES) -Iinclude ; \
77 for arg in $(EXT_FUNC) \
78 ; do \
79 sed "s/ .*_init/ _init/" extensions/ebt_$${arg}.c > extensions/ebt_$${arg}.c_ ; \
80 mv extensions/ebt_$${arg}.c_ extensions/ebt_$${arg}.c ; \
81 done ; \
82 for arg in $(EXT_TABLES) \
83 ; do \
84 sed "s/ .*_init/ _init/" extensions/ebtable_$${arg}.c > extensions/ebtable_$${arg}.c_ ; \
85 mv extensions/ebtable_$${arg}.c_ extensions/ebtable_$${arg}.c ; \
86 done ; \
87 mv ebtables-standalone.c_ ebtables-standalone.c ; \
88 mv include/ebtables_u.h_ include/ebtables_u.h
90 .PHONY: install
91 install: build
92 $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
93 $(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(PRIVATE_BINDIR)
95 .PHONY: clean
96 clean:
97 rm -f imqebt
98 rm -f *.o *~ *.so