aboutsummaryrefslogtreecommitdiffstats
path: root/src/build-data/makefile/gmake.in
blob: dd2fa418d004ae8b7bc19a4d19fb0297093b0698 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%{header_in}

%{gmake_commands_in}

# Executable targets
APP           = %{out_dir}/botan%{program_suffix}
TEST          = %{out_dir}/botan-test%{program_suffix}

# Library targets
LIB_BASENAME  = %{lib_prefix}%{libname}
STATIC_LIB    = %{out_dir}/$(LIB_BASENAME).%{static_suffix}
LIBRARIES     = $(STATIC_LIB)

# File Lists
INCLUDE_DIR   = %{botan_include_dir}

LIBOBJS       = %{lib_objs}

APPOBJS       = %{app_objs}

TESTOBJS      = %{test_objs}

# First make target. Will be used by default
all: $(APP) $(TEST)

# Build Commands
%{lib_build_cmds}

%{app_build_cmds}

%{test_build_cmds}

# Link Commands
%{gmake_dso_in}

$(APP): $(LIBRARIES) $(APPOBJS)
	$(CXX) $(LDFLAGS) $(APPOBJS) -L%{out_dir} -l%{libname} $(APP_LINKS_TO) -o $(APP)

$(TEST): $(LIBRARIES) $(TESTOBJS)
	$(CXX) $(LDFLAGS) $(TESTOBJS) -L%{out_dir} -l%{libname} $(TEST_LINKS_TO) -o $(TEST)

$(STATIC_LIB): $(LIBOBJS)
	$(RM) $(STATIC_LIB)
	$(AR) $(STATIC_LIB) $(LIBOBJS)
	$(RANLIB) $(STATIC_LIB)

# Fake targets
.PHONY = clean distclean docs website install valgrind lcov

%{gmake_coverage_in}

SPHINX_CONFIG = %{sphinx_config_dir}
SPHINX_OPTS = -b html

WEBSITE_DIR=%{doc_output_dir}/website
WEBSITE_SRC_DIR=%{doc_output_dir}/website-src

clean:
	-$(RM) %{libobj_dir}/*
	-$(RM) %{testobj_dir}/*
	-$(RM) %{appobj_dir}/*
	-$(RM) $(SONAME) $(SYMLINK)
	-$(RM) $(LIBRARIES) $(APP) $(TEST)

distclean: clean
	$(RM) Makefile
	$(RM_R) %{build_dir}
	$(RM) botan_all.cpp botan_all.h

valgrind:
	valgrind --log-file=botan.%%p.log -v --track-origins=yes --leak-check=full --show-reachable=yes ./botan-test

docs:
%{build_doc_commands}

install: $(APP) docs
	$(SCRIPTS_DIR)/install.py --destdir=%{destdir} --build-dir="%{build_dir}" --bindir=%{bindir} --libdir=%{libdir} --docdir=%{docdir} --includedir=%{includedir}

website:
	rm -rf $(WEBSITE_SRC_DIR) $(WEBSITE_DIR)
	mkdir -p $(WEBSITE_SRC_DIR)
	cp -r %{doc_dir}/*.txt %{doc_dir}/*.rst %{doc_dir}/relnotes %{doc_dir}/website/*.rst $(WEBSITE_SRC_DIR)
	./src/scripts/combine_relnotes.py %{doc_dir}/relnotes > $(WEBSITE_SRC_DIR)/news.rst
	sphinx-build -c $(SPHINX_CONFIG) -b html $(WEBSITE_SRC_DIR) $(WEBSITE_DIR)
	sphinx-build -c $(SPHINX_CONFIG) -b html %{doc_dir}/manual $(WEBSITE_DIR)/manual
	rm -rf $(WEBSITE_DIR)/.doctrees
	rm -rf $(WEBSITE_DIR)/manual/.doctrees
	rm -f $(WEBSITE_DIR)/.buildinfo
	rm -f $(WEBSITE_DIR)/manual/.buildinfo
	doxygen %{build_dir}/botan.doxy
	mv %{doc_output_dir}/doxygen $(WEBSITE_DIR)/doxygen