PageRenderTime 1058ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/vpnc-0.5.3/Makefile

https://github.com/heinervdm/vpnc
Makefile | 151 lines | 90 code | 27 blank | 34 comment | 3 complexity | d1a8e234b73ae8c4baa80827de53e46a MD5 | raw file
  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
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. # $Id$
  20. DESTDIR=
  21. PREFIX=/usr/local
  22. ETCDIR=/etc/vpnc
  23. BINDIR=$(PREFIX)/bin
  24. SBINDIR=$(PREFIX)/sbin
  25. MANDIR=$(PREFIX)/share/man
  26. DOCDIR=$(PREFIX)/share/doc/vpnc
  27. SRCS = sysdep.c vpnc-debug.c isakmp-pkt.c tunip.c config.c dh.c math_group.c supp.c decrypt-utils.c
  28. BINS = vpnc cisco-decrypt
  29. OBJS = $(addsuffix .o,$(basename $(SRCS)))
  30. BINOBJS = $(addsuffix .o,$(BINS))
  31. BINSRCS = $(addsuffix .c,$(BINS))
  32. VERSION := $(shell sh mk-version)
  33. RELEASE_VERSION := $(shell cat VERSION)
  34. # The license of vpnc (Gpl >= 2) is quite likely incompatible with the
  35. # openssl license. Openssl is currently used to provide certificate
  36. # support for vpnc (hybrid only).
  37. # While it is OK for users to build their own binaries linking in openssl
  38. # with vpnc and even providing dynamically linked binaries it is probably
  39. # not OK to provide the binaries inside a distribution.
  40. # See http://www.gnome.org/~markmc/openssl-and-the-gpl.html for further
  41. # details.
  42. # Some distributions like Suse and Fedora seem to think otherwise.
  43. # Comment this in to obtain a binary with certificate support which is
  44. # GPL incompliant though.
  45. #OPENSSL_GPL_VIOLATION = -DOPENSSL_GPL_VIOLATION
  46. #OPENSSLLIBS = -lcrypto
  47. CC=gcc
  48. CFLAGS ?= -O3 -g
  49. CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings
  50. CFLAGS += $(shell libgcrypt-config --cflags)
  51. CPPFLAGS += -DVERSION=\"$(VERSION)\" $(OPENSSL_GPL_VIOLATION)
  52. LDFLAGS ?= -g
  53. LDFLAGS += $(shell libgcrypt-config --libs) $(OPENSSLLIBS)
  54. ifeq ($(shell uname -s), SunOS)
  55. LDFLAGS += -lnsl -lresolv -lsocket
  56. endif
  57. ifneq (,$(findstring Apple,$(shell $(CC) --version)))
  58. # enabled in FSF GCC, disabled by default in Apple GCC
  59. CFLAGS += -fstrict-aliasing -freorder-blocks -fsched-interblock
  60. endif
  61. all : $(BINS) vpnc.8 vpnc-script
  62. vpnc : $(OBJS) vpnc.o
  63. $(CC) -o $@ $^ $(LDFLAGS)
  64. vpnc.8 : vpnc.8.template makeman.pl vpnc
  65. ./makeman.pl
  66. vpnc-script : vpnc-script.in
  67. sed -e 's,@''PREFIX''@,$(PREFIX),g' $< > $@ && chmod 755 $@
  68. cisco-decrypt : cisco-decrypt.o decrypt-utils.o
  69. $(CC) -o $@ $^ $(LDFLAGS)
  70. .depend: $(SRCS) $(BINSRCS)
  71. $(CC) -MM $(SRCS) $(BINSRCS) $(CFLAGS) $(CPPFLAGS) > $@
  72. vpnc-debug.c vpnc-debug.h : isakmp.h enum2debug.pl
  73. LC_ALL=C perl -w ./enum2debug.pl isakmp.h >vpnc-debug.c 2>vpnc-debug.h
  74. vpnc.ps : vpnc.c
  75. enscript -E -G -T 4 --word-wrap -o- $^ | psnup -2 /dev/stdin $@
  76. ../vpnc-%.tar.gz : vpnc-$*.tar.gz
  77. etags :
  78. etags *.[ch]
  79. ctags :
  80. ctags *.[ch]
  81. vpnc-%.tar.gz :
  82. mkdir vpnc-$*
  83. LC_ALL=C svn info -R | awk -v RS='' -v FS='\n' '/Node Kind: file/ {print substr($$1,7)}' | \
  84. tar -cf - -T - | tar -xf - -C vpnc-$*/
  85. tar -czf ../$@ vpnc-$*
  86. rm -rf vpnc-$*
  87. dist : VERSION vpnc.8 vpnc-$(RELEASE_VERSION).tar.gz
  88. clean :
  89. -rm -f $(OBJS) $(BINOBJS) $(BINS) tags
  90. distclean : clean
  91. -rm -f vpnc-debug.c vpnc-debug.h vpnc.ps vpnc.8 .depend vpnc-script
  92. install-common: all
  93. install -d $(DESTDIR)$(ETCDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(DOCDIR)
  94. if [ "`uname -s | cut -c-6`" = "CYGWIN" ]; then \
  95. install vpnc-script-win $(DESTDIR)$(ETCDIR)/vpnc-script; \
  96. install vpnc-script-win.js $(DESTDIR)$(ETCDIR); \
  97. else \
  98. install vpnc-script $(DESTDIR)$(ETCDIR); \
  99. fi
  100. install -m600 vpnc.conf $(DESTDIR)$(ETCDIR)/default.conf
  101. install -m755 vpnc-disconnect $(DESTDIR)$(SBINDIR)
  102. install -m755 pcf2vpnc $(DESTDIR)$(BINDIR)
  103. install -m644 vpnc.8 $(DESTDIR)$(MANDIR)/man8
  104. install -m644 pcf2vpnc.1 $(DESTDIR)$(MANDIR)/man1
  105. install -m644 cisco-decrypt.1 $(DESTDIR)$(MANDIR)/man1
  106. install -m644 COPYING $(DESTDIR)$(DOCDIR)
  107. install : install-common
  108. install -m755 vpnc $(DESTDIR)$(SBINDIR)
  109. install -m755 cisco-decrypt $(DESTDIR)$(BINDIR)
  110. install-strip : install-common
  111. install -s -m755 vpnc $(DESTDIR)$(SBINDIR)
  112. install -s -m755 cisco-decrypt $(DESTDIR)$(BINDIR)
  113. uninstall :
  114. rm -f $(DESTDIR)$(SBINDIR)/vpnc \
  115. $(DESTDIR)$(SBINDIR)/vpnc-disconnect \
  116. $(DESTDIR)$(BINDIR)/pcf2vpnc \
  117. $(DESTDIR)$(BINDIR)/cisco-decrypt \
  118. $(DESTDIR)$(MANDIR)/man1/cisco-decrypt.1 \
  119. $(DESTDIR)$(MANDIR)/man1/pcf2vpnc \
  120. $(DESTDIR)$(MANDIR)/man8/vpnc.8
  121. @echo NOTE: remove $(DESTDIR)$(ETCDIR) manually
  122. .PHONY : clean distclean dist all install install-strip uninstall
  123. #
  124. -include .depend