- applied patch for charon (this time really)
[strongswan.git] / programs / starter / Makefile
1 # ipsec starter Makefile
2 # Copyright (C) 2001 Mathieu Lafon - Arkoon Network Security
3 #
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; either version 2 of the License, or (at your
7 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # for more details.
13 #
14 # RCSID $Id: Makefile,v 1.14 2006/02/17 19:34:02 as Exp $
15
16 FREESWANSRCDIR?=$(shell cd ../..; pwd)
17 include ${FREESWANSRCDIR}/Makefile.inc
18
19 LD=$(CC)
20 RM=rm
21 LEX=flex
22 BISON=bison
23 GPERF=gperf
24
25 FREESWANDIR=../..
26 FREESWANLIB=$(FREESWANDIR)/lib/libfreeswan/libfreeswan.a
27 PLUTODIR=../pluto
28 OPENACDIR=../openac
29
30 DEFINES+= -DVIRTUAL_IP -DDEBUG
31
32 # This compile option activates the leak detective
33 ifeq ($(USE_LEAK_DETECTIVE),true)
34 DEFINES+= -DLEAK_DETECTIVE
35 endif
36
37 # Enable charon support
38 ifeq ($(USE_IKEV2),true)
39 DEFINES+= -DIKEV2
40 endif
41
42 INCLUDES=-I${FREESWANDIR}/linux/include
43 CFLAGS=$(DEFINES) $(INCLUDES) -Wall
44 CFLAGS+=-DIPSEC_EXECDIR=\"${FINALLIBEXECDIR}\" -DIPSEC_CONFDDIR=\"${FINALCONFDDIR}\"
45 CFLAGS+=-DIPSEC_CONFDIR=\"${FINALCONFDIR}\"
46 LDFLAGS=
47
48 PLUTO_OBJS=defs.o
49
50 OBJS=starter.o parser.tab.o lex.yy.o keywords.o args.o invokepluto.o \
51 starterwhack.o klips.o netkey.o interfaces.o exec.o cmp.o confread.o \
52 loglite.o ${PLUTO_OBJS}
53
54 # Build charon-only objs
55 ifeq ($(USE_IKEV2),true)
56 OBJS+= invokecharon.o starterstroke.o
57 endif
58
59 DISTSRC=$(OBJS:.o=.c)
60 DISTSRC+=cmp.h confread.h confwrite.h exec.h files.h interfaces.h klips.h netkey.h
61 DISTSRC+=parser.h args.h invokepluto.h starterwhack.h keywords.h keywords.txt
62
63 LIBS=$(FREESWANLIB)
64
65 PROGRAM=starter
66
67 include ../Makefile.program
68
69 all: starter
70
71 starter: $(OBJS) $(FREESWANLIB)
72 $(LD) $(LDFLAGS) -o starter $(OBJS) $(LIBS)
73
74 lex.yy.c: parser.tab.c parser.l parser.y parser.h
75 $(LEX) parser.l
76
77 parser.tab.c: parser.l parser.y parser.h
78 $(BISON) -v -d parser.y
79
80 keywords.c: keywords.txt keywords.h
81 $(GPERF) -C -G -t < keywords.txt > keywords.c
82
83 .c.o:
84 $(CC) $(CFLAGS) -c $<
85
86 loglite.o : $(OPENACDIR)/loglite.c $(PLUTODIR)/log.h
87 $(CC) $(CFLAGS) -c -o $@ $<
88
89 # pluto library
90
91 defs.o : $(PLUTODIR)/defs.c $(PLUTODIR)/defs.h
92 $(CC) $(CFLAGS) -c -o $@ $<
93
94 clean::
95 $(RM) -f starter $(OBJS) parser.tab.* lex.yy.*
96
97 # Stolen from pluto/Makefile
98
99 gatherdeps:
100 @ls | grep '\.c$$' | sed -e 's/\(.*\)\.c$$/\1.o: \1.c/'
101 @echo
102 @ls | grep '\.c$$' | xargs grep '^#[ ]*include[ ]*"' | \
103 sed -e 's/\.c:#[ ]*include[ ]*"/.o: /' -e 's/".*//'
104
105 # Dependencies generated by "make gatherdeps":
106
107 args.o: args.c
108 cmp.o: cmp.c
109 confread.o: confread.c
110 exec.o: exec.c
111 interfaces.o: interfaces.c
112 invokepluto.o: invokepluto.c
113 keywords.o: keywords.c
114 klips.o: klips.c
115 lex.yy.o: lex.yy.c
116 netkey.o: netkey.c
117 parser.tab.o: parser.tab.c
118 starter.o: starter.c
119 starterwhack.o: starterwhack.c
120
121 args.o: ../pluto/constants.h
122 args.o: ../pluto/defs.h
123 args.o: ../pluto/log.h
124 args.o: keywords.h
125 args.o: parser.h
126 args.o: confread.h
127 args.o: args.h
128 cmp.o: ../pluto/constants.h
129 cmp.o: ../pluto/defs.h
130 cmp.o: confread.h
131 cmp.o: args.h
132 cmp.o: interfaces.h
133 cmp.o: cmp.h
134 confread.o: ../pluto/constants.h
135 confread.o: ../pluto/defs.h
136 confread.o: ../pluto/log.h
137 confread.o: keywords.h
138 confread.o: parser.h
139 confread.o: confread.h
140 confread.o: args.h
141 confread.o: interfaces.h
142 exec.o: ../pluto/constants.h
143 exec.o: ../pluto/defs.h
144 exec.o: ../pluto/log.h
145 exec.o: exec.h
146 interfaces.o: ../pluto/constants.h
147 interfaces.o: ../pluto/defs.h
148 interfaces.o: ../pluto/log.h
149 interfaces.o: interfaces.h
150 interfaces.o: exec.h
151 interfaces.o: files.h
152 invokepluto.o: ../pluto/constants.h
153 invokepluto.o: ../pluto/defs.h
154 invokepluto.o: ../pluto/log.h
155 invokepluto.o: confread.h
156 invokepluto.o: invokepluto.h
157 invokepluto.o: files.h
158 invokepluto.o: starterwhack.h
159 keywords.o: keywords.h
160 klips.o: ../pluto/constants.h
161 klips.o: ../pluto/defs.h
162 klips.o: ../pluto/log.h
163 klips.o: confread.h
164 klips.o: klips.h
165 klips.o: files.h
166 klips.o: exec.h
167 lex.yy.o: parser.tab.h
168 netkey.o: ../pluto/constants.h
169 netkey.o: ../pluto/defs.h
170 netkey.o: ../pluto/log.h
171 netkey.o: files.h
172 parser.tab.o: ../pluto/constants.h
173 parser.tab.o: ../pluto/defs.h
174 parser.tab.o: parser.h
175 starter.o: ../pluto/constants.h
176 starter.o: ../pluto/defs.h
177 starter.o: ../pluto/log.h
178 starter.o: confread.h
179 starter.o: files.h
180 starter.o: starterwhack.h
181 starter.o: invokepluto.h
182 starter.o: klips.h
183 starter.o: netkey.h
184 starter.o: cmp.h
185 starter.o: interfaces.h
186 starterwhack.o: ../pluto/constants.h
187 starterwhack.o: ../pluto/defs.h
188 starterwhack.o: ../pluto/log.h
189 starterwhack.o: ../pluto/whack.h
190 starterwhack.o: starterwhack.h
191 starterwhack.o: confread.h
192 starterwhack.o: files.h