1 # Makefile for an IPSec VPN client compatible with Cisco equipment.
2 # Copyright (C) 2002 Geoffrey Keating
3 # Copyright (C) 2003-2004 Maurice Massar
4 # Copyright (C) 2006-2007 Dan Villiom Podlaski Christiansen
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 SBINDIR
=$(PREFIX
)/sbin
27 MANDIR
=$(PREFIX
)/share
/man
28 DOCDIR
=$(PREFIX
)/share
/doc
/vpnc
30 # The license of vpnc (Gpl >= 2) is quite likely incompatible with the
31 # openssl license. Openssl is one possible library used to provide certificate
32 # support for vpnc (hybrid only).
33 # While it is OK for users to build their own binaries linking in openssl
34 # with vpnc and even providing dynamically linked binaries it is probably
35 # not OK to provide the binaries inside a distribution.
36 # See http://www.gnome.org/~markmc/openssl-and-the-gpl.html for further
38 # Some distributions like Suse and Fedora seem to think otherwise.
40 # Comment this in to obtain a binary with certificate support which is
41 # GPL incompliant though.
42 #OPENSSL_GPL_VIOLATION=yes
44 CRYPTO_LDADD
= $(shell pkg-config
--libs gnutls
)
45 CRYPTO_CFLAGS
= $(shell pkg-config
--cflags gnutls
) -DCRYPTO_GNUTLS
46 CRYPTO_SRCS
= crypto-gnutls.c
48 ifeq ($(OPENSSL_GPL_VIOLATION
), yes
)
49 CRYPTO_LDADD
= -lcrypto
50 CRYPTO_CFLAGS
= -DOPENSSL_GPL_VIOLATION
-DCRYPTO_OPENSSL
51 CRYPTO_SRCS
= crypto-openssl.c
54 SRCS
= sysdep.c vpnc-debug.c isakmp-pkt.c tunip.c config.c dh.c math_group.c supp.c decrypt-utils.c crypto.c
$(CRYPTO_SRCS
)
55 BINS
= vpnc cisco-decrypt test-crypto
56 OBJS
= $(addsuffix .o
,$(basename $(SRCS
)))
57 CRYPTO_OBJS
= $(addsuffix .o
,$(basename $(CRYPTO_SRCS
)))
58 BINOBJS
= $(addsuffix .o
,$(BINS
))
59 BINSRCS
= $(addsuffix .c
,$(BINS
))
60 VERSION
:= $(shell sh mk-version
)
61 RELEASE_VERSION
:= $(shell cat VERSION
)
65 CFLAGS
+= -W
-Wall
-Wmissing-declarations
-Wwrite-strings
66 CFLAGS
+= $(shell libgcrypt-config
--cflags) $(CRYPTO_CFLAGS
)
67 CPPFLAGS
+= -DVERSION
=\"$(VERSION
)\"
69 LDFLAGS
+= $(shell libgcrypt-config
--libs
) $(CRYPTO_LDADD
)
71 ifeq ($(shell uname
-s
), SunOS
)
72 LDFLAGS
+= -lnsl
-lresolv
-lsocket
74 ifneq (,$(findstring Apple
,$(shell $(CC
) --version
)))
75 # enabled in FSF GCC, disabled by default in Apple GCC
76 CFLAGS
+= -fstrict-aliasing
-freorder-blocks
-fsched-interblock
82 $(CC
) -o
$@
$^
$(LDFLAGS
)
84 vpnc
.8 : vpnc
.8.template makeman.pl vpnc
87 cisco-decrypt
: cisco-decrypt.o decrypt-utils.o
88 $(CC
) -o
$@
$^
$(LDFLAGS
)
90 test-crypto
: sysdep.o test-crypto.o crypto.o
$(CRYPTO_OBJS
)
91 $(CC
) -o
$@
$^
$(LDFLAGS
)
93 .depend
: $(SRCS
) $(BINSRCS
)
94 $(CC
) -MM
$(SRCS
) $(BINSRCS
) $(CFLAGS
) $(CPPFLAGS
) > $@
96 vpnc-debug.c vpnc-debug.h
: isakmp.h enum2debug.pl
97 LC_ALL
=C perl
-w .
/enum2debug.pl isakmp.h
>vpnc-debug.c
2>vpnc-debug.h
100 enscript
-E
-G
-T
4 --word-wrap
-o-
$^ | psnup
-2 /dev
/stdin
$@
102 ..
/vpnc-
%.
tar.gz
: vpnc-
$*.
tar.gz
111 LC_ALL
=C svn
info -R | awk
-v RS
='' -v FS
='\n' '/Node Kind: file/ {print substr($$1,7)}' | \
112 tar -cf
- -T
- |
tar -xf
- -C vpnc-
$*/
113 tar -czf ..
/$@ vpnc-
$*
117 .
/test-crypto
test/cert.pem
test/cert0.pem
test/cert1.pem
test/cert2.pem
test/root.pem
118 #./test-crypto test/cert.pem test/cert0.crt test/cert1.crt test/cert2.crt test/root.crt
120 dist : VERSION vpnc
.8 vpnc-
$(RELEASE_VERSION
).
tar.gz
123 -rm -f
$(OBJS
) $(BINOBJS
) $(BINS
) tags
126 -rm -f vpnc-debug.c vpnc-debug.h vpnc.ps vpnc
.8 .depend
129 install -d
$(DESTDIR
)$(ETCDIR
) $(DESTDIR
)$(BINDIR
) $(DESTDIR
)$(SBINDIR
) $(DESTDIR
)$(MANDIR
)/man1
$(DESTDIR
)$(MANDIR
)/man8
$(DESTDIR
)$(DOCDIR
)
130 if
[ "`uname -s | cut -c-6`" = "CYGWIN" ]; then \
131 install vpnc-script-win
$(DESTDIR
)$(ETCDIR
)/vpnc-script
; \
132 install vpnc-script-win.js
$(DESTDIR
)$(ETCDIR
); \
134 install vpnc-script
$(DESTDIR
)$(ETCDIR
); \
136 install -m600 vpnc.conf
$(DESTDIR
)$(ETCDIR
)/default.conf
137 install -m755 vpnc-disconnect
$(DESTDIR
)$(SBINDIR
)
138 install -m755 pcf2vpnc
$(DESTDIR
)$(BINDIR
)
139 install -m644 vpnc
.8 $(DESTDIR
)$(MANDIR
)/man8
140 install -m644 pcf2vpnc
.1 $(DESTDIR
)$(MANDIR
)/man1
141 install -m644 cisco-decrypt
.1 $(DESTDIR
)$(MANDIR
)/man1
142 install -m644 COPYING
$(DESTDIR
)$(DOCDIR
)
144 install : install-common
145 install -m755 vpnc
$(DESTDIR
)$(SBINDIR
)
146 install -m755 cisco-decrypt
$(DESTDIR
)$(BINDIR
)
148 install-strip
: install-common
149 install -s
-m755 vpnc
$(DESTDIR
)$(SBINDIR
)
150 install -s
-m755 cisco-decrypt
$(DESTDIR
)$(BINDIR
)
153 rm -f
$(DESTDIR
)$(SBINDIR
)/vpnc \
154 $(DESTDIR
)$(SBINDIR
)/vpnc-disconnect \
155 $(DESTDIR
)$(BINDIR
)/pcf2vpnc \
156 $(DESTDIR
)$(BINDIR
)/cisco-decrypt \
157 $(DESTDIR
)$(MANDIR
)/man1
/cisco-decrypt
.1 \
158 $(DESTDIR
)$(MANDIR
)/man1
/pcf2vpnc \
159 $(DESTDIR
)$(MANDIR
)/man8
/vpnc
.8
160 @echo NOTE
: remove
$(DESTDIR
)$(ETCDIR
) manually
162 .PHONY
: clean distclean dist all install install-strip
uninstall