1 # $OpenBSD: GNUmakefile,v 1.9 2004/08/08 19:11:06 deraadt Exp $
4 # Copyright (c) 1998, 1999, 2000 Niklas Hallqvist. All rights reserved.
5 # Copyright (c) 2000 HÃ¥kan Olsson. All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # This code was written under funding by Ericsson Radio Systems.
33 # This makefile is a GNU makefile, which is generally available on most
34 # systems, either as "make" or (often) "gmake". It has been converted from
35 # a 'pmake' makefile (OpenBSDs 'make'), and some care has been taken to
36 # produce similar behaviour.
39 # openbsd means 2.5 or newer, freeswan is the name for Linux with FreeS/WAN
40 # integrated, freebsd/netbsd means FreeBSD/NetBSD with KAME IPsec.
41 # darwin means MacOS X 10.2 and later with KAME IPsec. linux means Linux-2.5
42 # and later with native IPSec support.
50 .CURDIR
:= $(shell pwd
)
51 VPATH
= ${.CURDIR
}/sysdep
/${OS}
63 SRCS
= app.c attribute.c cert.c connection.c \
64 constants.c conf.c cookie.c crypto.c dh.c doi.c exchange.c \
65 exchange_num.c field.c gmp_util.c hash.c if.c ike_auth.c \
66 ike_main_mode.c ike_phase_1.c ike_quick_mode.c init.c \
67 ipsec.c ipsec_fld.c ipsec_num.c isakmpd.c isakmp_doi.c \
68 isakmp_fld.c isakmp_num.c key.c libcrypto.c log.c message.c \
69 math_2n.c math_group.c prf.c sa.c sysdep.c timer.c \
70 transport.c udp.c ui.c util.c virtual.c
72 GENERATED
= exchange_num.h ipsec_fld.h ipsec_num.h isakmp_fld.h \
74 CLEANFILES
= exchange_num.c exchange_num.h ipsec_num.c ipsec_num.h \
75 isakmp_num.c isakmp_num.h ipsec_fld.c ipsec_fld.h \
76 isakmp_fld.c isakmp_fld.h
77 MAN
= isakmpd
.8 isakmpd.conf
.5 isakmpd.policy
.5
79 CFLAGS
+= -O2
${DEBUG} -Wall
-DNEED_SYSDEP_APP \
80 -I
${.CURDIR
} -I
${.CURDIR
}/sysdep
/${OS} -I. \
82 # Different debugging & profiling suggestions
84 # Include symbolic debugging info
87 # Do execution time profiles
90 # If you have ElectricFence available, you can spot abuses of the heap.
91 # (/usr/ports/devel/ElectricFence)
92 #LDADD+= -L/usr/local/lib -lefence
93 #DPADD+= /usr/local/lib/libefence.a
95 # If you like to use Boehm's garbage collector (/usr/ports/devel/boehm-gc).
96 #LDADD+= -L/usr/local/lib -lgc
97 #DPADD+= /usr/local/lib/libgc.a
99 # You can also use Boehm's garbage collector as a means to find leaks.
100 # XXX The defines below are GCC-specific. I think it is OK to require
101 # XXX GCC if you are debugging isakmpd in this way.
102 #LDADD+= -L/usr/local/lib -lleak
103 #DPADD+= /usr/local/lib/libleak.a
104 #CFLAGS+= -D'malloc(x)=({ \
105 # void *GC_debug_malloc (size_t, char *, int); \
106 # GC_debug_malloc ((x), __FILE__, __LINE__); \
108 # -D'realloc(x,y)=({ \
109 # void *GC_debug_realloc (void *, size_t, char *, int); \
110 # GC_debug_realloc ((x), (y), __FILE__, __LINE__); \
113 # void GC_debug_free (void *); \
114 # GC_debug_free (x); \
116 # -D'calloc(x,y)=malloc((x) * (y))' \
118 # char *strcpy (char *, const char *); \
119 # const char *_x_ = (x); \
120 # char *_y_ = malloc (strlen (_x_) + 1); \
121 # strcpy (_y_, _x_); \
124 # Ignore any files with these names...
125 .PHONY
: mksubdirs
all clean cleandir cleandepend beforedepend \
126 afterdepend
realclean realcleandepend
128 # Default target, it needs to be the first target in makefile... :(
130 all: ${PROG} mksubdirs
132 ifneq ($(findstring install,$(MAKECMDGOALS
)),install)
133 # Skip 'regress' until the regress/ structure has gmake makefiles for it.
135 SUBDIR
:= apps
/certpatch
137 $(foreach DIR
, ${SUBDIR}, \
138 cd
${.CURDIR
}/${DIR}; ${MAKE} ${MAKECMDGOALS};)
140 # $(foreach DIR, ${SUBDIR}, \
141 # cd ${DIR}; ${MAKE} CFLAGS="${CFLAGS}" \
142 # MKDEP="${MKDEP}" ${MAKECMDGOALS})
147 # DEPSRCS handling is *ugly*, I know...
148 # What is does; keep orig SRCS in ORIGSRCS; potentially add stuff to
149 # SRCS (include); let DEPSRCS be ORIGSRCS (sysdep.c -> sysdep/<os>/sysdep.c)
150 # _plus_ any new sources, located either in cwd or sysdep/<os>. Phew.
153 -include sysdep
/${OS}/GNUmakefile.sysdep
155 FEATURES_UC
= $(shell echo
${FEATURES} | tr
'[:lower:]' '[:upper:]')
156 CFLAGS
+= $(foreach F
, ${FEATURES_UC}, -DUSE_
${F})
157 -include $(foreach F
, ${FEATURES}, features
/${F})
161 LDADD
+= -lkeynote
-lm
162 DPADD
+= ${LIBKEYNOTE} ${LIBM}
164 CFLAGS
+= -DUSE_KEYNOTE
169 CFLAGS
+= -DUSE_LIBCRYPTO
176 CFLAGS
+= -DUSE_RAWKEY
179 SRCS
+= ${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \
180 $(ISAKMP_CFG
) ${DPD} ${NAT_TRAVERSAL}
181 CFLAGS
+= ${IPSEC_CFLAGS}
185 DEPSRCS
:= $(subst sysdep.c
,${VPATH}/sysdep.c
,${ORIGSRCS}) \
186 $(foreach FILE
, $(filter-out ${ORIGSRCS},${SRCS}), \
187 $(wildcard .
/${FILE} ${VPATH}/${FILE}))
188 OBJS
:= $(SRCS
:%.c
=%.o
)
191 exchange_num.c exchange_num.h
: genconstants.sh exchange_num.cst
192 /bin
/sh
${.CURDIR
}/genconstants.sh
${.CURDIR
}/exchange_num
194 ipsec_fld.c ipsec_fld.h
: genfields.sh ipsec_fld.fld
195 /bin
/sh
${.CURDIR
}/genfields.sh
${.CURDIR
}/ipsec_fld
197 ipsec_num.c ipsec_num.h
: genconstants.sh ipsec_num.cst
198 /bin
/sh
${.CURDIR
}/genconstants.sh
${.CURDIR
}/ipsec_num
200 isakmp_fld.c isakmp_fld.h
: genfields.sh isakmp_fld.fld
201 /bin
/sh
${.CURDIR
}/genfields.sh
${.CURDIR
}/isakmp_fld
203 isakmp_num.c isakmp_num.h
: genconstants.sh isakmp_num.cst
204 /bin
/sh
${.CURDIR
}/genconstants.sh
${.CURDIR
}/isakmp_num
207 ${PROG} beforedepend
: ${GENERATED}
209 ${PROG}: ${OBJS} ${DPADD}
210 ${CC} ${DEBUG} ${LDFLAGS} ${LDSTATIC} -o
$@
${OBJS} ${LDADD}
213 depend
: beforedepend .depend mksubdirs afterdepend
216 # Since 'mkdep' et al maybe doesn't exist...
221 ${MKDEP} ${CFLAGS} ${DEPSRCS} > .depend
225 ifneq ($(findstring clean, $(MAKECMDGOALS
)), clean)
226 # This will initially fail (when .depend does not exist), continue
227 # to create .depend, then make will automatically restart to include
228 # the generated .depend correctly. The '-' inhibits the warning msg.
234 cleandir
: realclean realcleandepend mksubdirs
236 clean: realclean mksubdirs
238 cleandepend
: realcleandepend mksubdirs
241 rm -f a.out core
*.core
${PROG} ${OBJS} ${CLEANFILES}