- startet importing pluto ASN1 stuff
[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 endif
20
21 BUILD_DIR= ./bin/
22
23 BINNAMECHARON= $(BUILD_DIR)charon
24 BINNAMESTROKE= $(BUILD_DIR)stroke
25 BINNAMETEST= $(BUILD_DIR)run_tests
26 BINNAMELIB= $(BUILD_DIR)libstrong.so
27
28 MAIN_DIR= ./
29
30 LDFLAGS= -ldl -lgmp -lpthread -rdynamic
31
32 CFLAGS= -Icharon -Ilib -Istroke -Wall -g -fPIC -DLEAK_DETECTIVE
33
34 # objects is extended by each included Makefile
35 CHARON_OBJS=
36 LIB_OBJS=
37 TEST_OBJS=
38
39 all : programs
40
41 include $(MAIN_DIR)charon/Makefile.charon
42 include $(MAIN_DIR)lib/Makefile.lib
43 include $(MAIN_DIR)stroke/Makefile.stroke
44 include $(MAIN_DIR)testing/Makefile.testcases
45
46 programs : $(BINNAMECHARON) $(BINNAMESTROKE)
47
48 test : $(BINNAMETEST)
49 LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMETEST)
50
51 run : $(BINNAMECHARON)
52 LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMECHARON)
53
54 apidoc :
55 doxygen Doxyfile
56
57 build_dir:
58 mkdir -p $(BUILD_DIR)
59
60 $(BINNAMELIB) : build_dir $(LIB_OBJS)
61 $(CC) -shared $(LIB_OBJS) -o $@
62
63 $(BINNAMECHARON) : build_dir $(CHARON_OBJS) $(BINNAMELIB) $(BUILD_DIR)daemon.o
64 $(CC) -ldl -lgmp -rdynamic -L./bin -lstrong -lpthread $(CHARON_OBJS) $(BUILD_DIR)daemon.o -o $@
65
66 $(BINNAMETEST) : build_dir $(CHARON_OBJS) $(TEST_OBJS) $(BINNAMELIB) $(BUILD_DIR)testcases.o
67 $(CC) -L./bin -lstrong $(LDFLAGS) $(CHARON_OBJS) $(TEST_OBJS) $(BUILD_DIR)testcases.o -o $@
68
69 $(BINNAMESTROKE) : build_dir $(BINNAMELIB) $(BUILD_DIR)stroke.o
70 $(CC) $(LDFLAGS) $(CFLAGS) $(BUILD_DIR)stroke.o -o $@
71
72 install : $(BINNAMECHARON) $(BINNAMESTROKE)
73 $(INSTALL) $(INSTBINFLAGS) $(BINNAMECHARON) $(BINNAMESTROKE) $(LIBEXECDIR)
74
75 install_file_list:
76 @echo $(LIBEXECDIR)/charon
77 @echo $(LIBEXECDIR)/stroke
78
79 clean :
80 rm -fR $(BUILD_DIR)
81
82 cleanall: clean
83
84 distclean: clean
85
86 mostlyclean: clean
87
88 realclean: clean