- added separate implementation for connection_store, credential_store, policy_store
[strongswan.git] / Source / Makefile
1 # Copyright (C) 2005 Jan Hutter, Martin Willi
2 # Hochschule fuer Technik Rapperswil
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
15 FREESWANSRCDIR=../..
16 # include strongswan Makefile, if charon sits in its tree
17 ifeq ($(shell ls $(FREESWANSRCDIR)/Makefile.inc 2>&1), ../../Makefile.inc)
18 include ${FREESWANSRCDIR}/Makefile.inc
19 else
20 # use leak detective by default
21 USE_LEAK_DETECTIVE?=true
22 endif
23
24
25
26
27 BUILD_DIR= ./bin/
28
29 BINNAMECHARON= $(BUILD_DIR)charon
30 BINNAMESTROKE= $(BUILD_DIR)stroke
31 BINNAMETEST= $(BUILD_DIR)run_tests
32 BINNAMELIB= $(BUILD_DIR)libstrongswan.so
33
34 MAIN_DIR= ./
35
36 CFLAGS= -Icharon -Ilib -Istroke -fPIC -Wall -g
37 ifeq ($(USE_LEAK_DETECTIVE),true)
38 CFLAGS+= -DLEAK_DETECTIVE
39 endif
40
41 # objects is extended by each included Makefile
42 CHARON_OBJS=
43 LIB_OBJS=
44 TEST_OBJS=
45
46 all : programs
47
48 include $(MAIN_DIR)charon/Makefile.charon
49 include $(MAIN_DIR)lib/Makefile.lib
50 include $(MAIN_DIR)stroke/Makefile.stroke
51 include $(MAIN_DIR)testing/Makefile.testcases
52
53 programs : $(BINNAMECHARON) $(BINNAMESTROKE)
54
55 test : $(BINNAMETEST)
56 LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMETEST)
57
58 run : $(BINNAMECHARON)
59 LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMECHARON)
60
61 apidoc :
62 doxygen Doxyfile
63
64 build_dir:
65 mkdir -p $(BUILD_DIR)
66
67 $(BINNAMELIB) : build_dir $(LIB_OBJS)
68 $(CC) -ldl -lgmp -lpthread -shared $(LIB_OBJS) -o $@
69
70 $(BINNAMECHARON) : build_dir $(CHARON_OBJS) $(BINNAMELIB) $(BUILD_DIR)daemon.o
71 $(CC) -L./bin -lstrongswan $(CHARON_OBJS) $(BUILD_DIR)daemon.o -o $@
72
73 $(BINNAMETEST) : build_dir $(CHARON_OBJS) $(TEST_OBJS) $(BINNAMELIB) $(BUILD_DIR)testcases.o
74 $(CC) -L./bin -lstrongswan $(LDFLAGS) $(CHARON_OBJS) $(TEST_OBJS) $(BUILD_DIR)testcases.o -o $@
75
76 $(BINNAMESTROKE) : build_dir $(BINNAMELIB) $(BUILD_DIR)stroke.o
77 $(CC) $(LDFLAGS) $(CFLAGS) $(BUILD_DIR)stroke.o -o $@
78
79 install : $(BINNAMECHARON) $(BINNAMESTROKE)
80 $(INSTALL) $(INSTBINFLAGS) $(BINNAMECHARON) $(BINNAMESTROKE) $(LIBEXECDIR)
81 $(INSTALL) $(INSTBINFLAGS) $(BINNAMELIB) $(SHAREDLIBDIR)
82
83 install_file_list:
84 @echo $(LIBEXECDIR)/charon
85 @echo $(LIBEXECDIR)/stroke
86 @echo $(SHAREDLIBDIR)/libstrongswan.so
87
88 clean :
89 rm -fR $(BUILD_DIR)
90
91 cleanall: clean
92
93 distclean: clean
94
95 mostlyclean: clean
96
97 realclean: clean