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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
include ${FREESWANSRCDIR}/Makefile.ver
CFLAGS+=$(USERCOMPILE) -I${KLIPSINC}
CFLAGS+= -Wall
#CFLAGS+= -Wconversion
#CFLAGS+= -Wmissing-prototypes
CFLAGS+= -Wpointer-arith
CFLAGS+= -Wcast-qual
#CFLAGS+= -Wmissing-declarations
CFLAGS+= -Wstrict-prototypes
#CFLAGS+= -pedantic
#CFLAGS+= -W
#CFLAGS+= -Wwrite-strings
CFLAGS+= -Wbad-function-cast
# die if there are any warnings
ifndef WERROR
WERROR:= -Werror
endif
#CFLAGS+= ${WERROR}
ifeq ($(USE_NAT_TRAVERSAL),true)
CFLAGS+= -DNAT_TRAVERSAL
endif
ifneq ($(LD_LIBRARY_PATH),)
LDFLAGS=-L$(LD_LIBRARY_PATH)
endif
MANDIR8=$(MANTREE)/man8
MANDIR5=$(MANTREE)/man5
ifndef PROGRAMDIR
PROGRAMDIR=${LIBEXECDIR}
endif
ifndef MANPROGPREFIX
MANPROGPREFIX=ipsec_
endif
ifndef CONFDSUBDIR
CONFDSUBDIR=.
endif
all: $(PROGRAM)
programs: all
ifneq ($(PROGRAM),check)
check: $(PROGRAM)
endif
ifneq ($(NOINSTALL),true)
install:: $(PROGRAM) $(CONFFILES) $(EXTRA8MAN) $(EXTRA5MAN) $(EXTRA5PROC) $(LIBFILES) $(CONFDFILES)
@mkdir -p $(PROGRAMDIR) $(MANDIR8) $(MANDIR5) $(LIBDIR) $(CONFDIR) $(CONFDDIR) $(CONFDDIR)/$(CONFDSUBDIR) $(EXAMPLECONFDIR)
@if [ -n "$(PROGRAM)" ]; then $(INSTALL) $(INSTBINFLAGS) $(PROGRAM) $(PROGRAMDIR); fi
@$(foreach f, $(addsuffix .8, $(PROGRAM)), \
$(INSTALL) $(INSTMANFLAGS) $f $(MANDIR8)/$(MANPROGPREFIX)$f || exit 1; \
)
@$(foreach f, $(EXTRA8MAN), \
$(INSTALL) $(INSTMANFLAGS) $f $(MANDIR8)/ipsec_$f || exit 1; \
)
@$(foreach f, $(EXTRA5MAN), \
$(INSTALL) $(INSTMANFLAGS) $f $(MANDIR5)/$f || exit 1 ;\
)
@$(foreach f, $(EXTRA5PROC), \
$(INSTALL) $(INSTMANFLAGS) $f $(MANDIR5)/ipsec_$f || exit 1 ;\
)
@$(foreach f, $(LIBFILES), \
$(INSTALL) $(INSTCONFFLAGS) $f $(LIBDIR)/$f || exit 1 ;\
)
@$(foreach f, $(CONFFILES), \
if [ ! -f $(CONFDIR)/$f ]; then $(INSTALL) $(INSTCONFFLAGS) $f $(CONFDIR)/$f || exit 1; fi;\
$(INSTALL) $(INSTCONFFLAGS) $f $(EXAMPLECONFDIR)/$f-sample || exit 1; \
)
@$(foreach f, $(CONFDFILES), \
if [ ! -f $(CONFDDIR)/$(CONFDSUBDIR)/$f ]; then $(INSTALL) $(INSTCONFFLAGS) $f $(CONFDDIR)/$(CONFDSUBDIR)/$f || exit 1; fi;\
)
install_file_list::
@if [ -n "$(PROGRAM)" ]; then echo $(PROGRAMDIR)/$(PROGRAM); fi
@$(foreach f, $(addsuffix .8, $(PROGRAM)), \
echo $(MANDIR8)/${MANPROGPREFIX}$f; \
)
@$(foreach f, $(EXTRA8MAN), \
echo $(MANDIR8)/ipsec_$f; \
)
@$(foreach f, $(EXTRA5MAN), \
echo $(MANDIR5)/$f;\
)
@$(foreach f, $(EXTRA5PROC), \
echo $(MANDIR5)/ipsec_$f; \
)
@$(foreach f, $(LIBFILES), \
echo $(LIBDIR)/$f;\
)
@$(foreach f, $(CONFFILES), \
echo $(CONFDIR)/$f;\
echo $(EXAMPLECONFDIR)/$f-sample;\
)
@$(foreach f, $(CONFDFILES), \
echo $(CONFDDIR)/${CONFDSUBDIR}/$f;\
)
endif
# cancel the rule that compiles directly
%: %.c
%: %.o $(OBJS)
$(CC) $(CFLAGS) -o $@ $@.o ${OBJS} $(LDFLAGS) $(LIBS)
%: %.in ${FREESWANSRCDIR}/Makefile.inc ${FREESWANSRCDIR}/Makefile.ver
cat $< | sed -e "s/xxx/$(IPSECVERSION)/" \
-e "s:@IPSEC_DIR@:$(FINALBINDIR):" \
-e "s:@IPSEC_EXECDIR@:$(FINALLIBEXECDIR):" \
-e "s:@IPSEC_SBINDIR@:$(FINALSBINDIR):" \
-e "s:@IPSEC_LIBDIR@:$(FINALLIBDIR):" \
-e "s:@FINALCONFDIR@:$(FINALCONFDIR):" \
-e "s:@EXAMPLECONFDIR@:$(EXAMPLECONFDIR):" \
-e "s:@FINALDOCDIR@:$(FINALDOCDIR):" \
-e "s:@FINALEXAMPLECONFDIR@:$(FINALEXAMPLECONFDIR):" \
-e "s:@MODULE_GOO_LIST@:$(MODULE_GOO_LIST):" \
-e "s:@IPSEC_CONFS@:$(FINALCONFDIR):" \
-e "s:@IPSEC_CONFDDIR@:$(FINALCONFDDIR):" \
-e "s:@USE_IPROUTE2@:$(USE_IPROUTE2):" \
-e "s:@IPSEC_FIREWALLTYPE@:$(IPSEC_FIREWALLTYPE):" \
| cat >$@
if [ -x $< ]; then chmod +x $@; fi
if [ "${PROGRAM}.in" = $< ]; then chmod +x $@; fi
cleanall: clean
distclean: clean
mostlyclean: clean
realclean: clean
clean::
ifneq ($(strip $(PROGRAM)),)
@if [ -r $(PROGRAM).in ]; then rm -f $(PROGRAM); fi
@if [ -r $(PROGRAM).c ]; then rm -f $(PROGRAM); fi
@if [ -n "$(OBJS)" ]; then rm -f $(PROGRAM); fi
endif
@rm -f *.o
checkprograms:
|