Makefile 3.89 KB
Newer Older
Daniel Brown's avatar
Daniel Brown committed
1
2
3
4
# $Id: Makefile 3068 2008-04-16 13:29:30Z adf $
#
# Main Makefile for Finesse

5
6
# work out the name of the host we're on
HOSTNAME = $(shell uname -n)
Andreas Freise's avatar
Andreas Freise committed
7

8
.PHONY: clean lib src doc/manual api api_clean realclean setup
Daniel Brown's avatar
Daniel Brown committed
9
10


11
default: kat
Andreas Freise's avatar
Andreas Freise committed
12

13
kat: lib src 
Andreas Freise's avatar
Andreas Freise committed
14

15
fast: kat
Andreas Freise's avatar
Andreas Freise committed
16

17
18
19
20
21
22
23
24
25
setup:
# work out the name of the host we're on
HOSTNAME = $(shell uname -n)

# Set defaults for including libraries
ifeq "$(ARCH)" "mac"
	INCLUDE_NICSLU=1
	INCLUDE_CUBA=1
	INCLUDE_NET=1
26
	INCLUDE_PARALUTION=0
27
28
29
30
else ifeq "$(ARCH)" "linux"
	INCLUDE_NICSLU=1
	INCLUDE_CUBA=1
	INCLUDE_NET=1
31
	INCLUDE_PARALUTION=0
32
else ifeq "$(ARCH)" "win32"
Daniel Brown's avatar
Daniel Brown committed
33
34
35
36
	ifeq "$(shell uname -o)" "Cygwin"
		INCLUDE_NICSLU=0
		INCLUDE_CUBA=1
		INCLUDE_NET=0
37
		INCLUDE_PARALUTION=0
Daniel Brown's avatar
Daniel Brown committed
38
39
40
41
	else
		INCLUDE_NICSLU=0
		INCLUDE_CUBA=0
		INCLUDE_NET=0
42
		INCLUDE_PARALUTION=0
Daniel Brown's avatar
Daniel Brown committed
43
	endif
44
else ifeq "$(ARCH)" "win64"
Daniel Brown's avatar
Daniel Brown committed
45
46
47
48
	ifeq "$(shell uname -o)" "Cygwin"
		INCLUDE_NICSLU=0
		INCLUDE_CUBA=1
		INCLUDE_NET=0
49
		INCLUDE_PARALUTION=0
Daniel Brown's avatar
Daniel Brown committed
50
51
52
53
	else
		INCLUDE_NICSLU=0
		INCLUDE_CUBA=0
		INCLUDE_NET=0
54
		INCLUDE_PARALUTION=0
Daniel Brown's avatar
Daniel Brown committed
55
	endif
56
57
endif

58
testarch: 
59
	$(eval archs := mac win32 win64 linux)
60
61
62
	$(eval archflag := $(filter $(ARCH), $(archs)))
	$(if $(filter $(ARCH), $(archs)), \
	@echo "Arch flag found for '$(archflag)'", \
63
	$(error Arch flag must be mac, win32, win64 or linux)) 
Daniel Brown's avatar
Daniel Brown committed
64
65

# library building target
66
lib: testarch setup
67
	$(MAKE) --directory=lib ARCH=$(ARCH) INCLUDE_NICSLU=$(INCLUDE_NICSLU) INCLUDE_CUBA=$(INCLUDE_CUBA) INCLUDE_NET=$(INCLUDE_NET) INCLUDE_PARALUTION=$(INCLUDE_PARALUTION)
Daniel Brown's avatar
Daniel Brown committed
68
69
70

# finesse building targets
src: lib
71
	$(MAKE) --directory=src ARCH=$(ARCH) INCLUDE_NICSLU=$(INCLUDE_NICSLU) INCLUDE_CUBA=$(INCLUDE_CUBA) INCLUDE_NET=$(INCLUDE_NET) INCLUDE_PARALUTION=$(INCLUDE_PARALUTION) kat 
Daniel Brown's avatar
Daniel Brown committed
72
73

debug: lib
74
	$(MAKE) --directory=src ARCH=$(ARCH) INCLUDE_NICSLU=$(INCLUDE_NICSLU) INCLUDE_CUBA=$(INCLUDE_CUBA) INCLUDE_NET=$(INCLUDE_NET) INCLUDE_PARALUTION=$(INCLUDE_PARALUTION) debug
Daniel Brown's avatar
Daniel Brown committed
75
76

prof: lib
77
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
78
79

config: lib
80
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
81
82

cover: lib
83
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
84
85

versionnumber: lib
86
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
87
88

test: lib
89
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
90
91

test_cover: lib
92
	$(MAKE) --directory=src ARCH=$(ARCH) $@
Daniel Brown's avatar
Daniel Brown committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

# documentation building targets
doc: doc/manual

doc/manual:
	$(MAKE) --directory=$@

api:
	$(MAKE) --directory=src $@

api_clean:
	$(MAKE) --directory=src $@

cover_report:
	$(MAKE) --directory=src $@

# cleanup targets
clean:
	$(MAKE) --directory=src $@

realclean:
	for d in lib src;  \
115
116
	do  \
	     $(MAKE) --directory=$$d clean; \
117
118
119
120
121
122
123
124
125
	done

	if ls lib/Cuba-3.2/*.a 1> /dev/null 2>&1; then \
		rm -f lib/Cuba-3.2/*.a; \
	fi;

	if ls lib/KLUsparse/*/Lib/*.a 1> /dev/null 2>&1; then \
		rm -f lib/KLUsparse/*/Lib/*.a; \
	fi;
Daniel Brown's avatar
Daniel Brown committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

# print out the possible options to pass to make
help:
	@echo "Possible targets are:"
	@echo "For building Finesse:"
	@echo "    kat: build with all optimisations"
	@echo "    fast: an alias for kat"
	@echo "    prof: build with profiling information switched on"
	@echo "    cover: build with code coverage information switched on"
	@echo "    debug: build with debugging information switched on"
	@echo "    versionnumber: build with all optimisations, and append"
	@echo "         svn (or svk) revision number to binary name"
	@echo "Testing:"
	@echo "    test: build and runs the unit tests"
	@echo "    test_cover: build and runs the unit tests, with coverage"
	@echo "                information switched on"
	@echo "For building the associated libraries:"
	@echo "    lib: builds all libraries required to build Finesse"
	@echo "Documentation:"
	@echo "    api: build the API level documentation"
	@echo "    cover_report: generate the coverage report with lcov"
	@echo "Other targets:"
	@echo "    clean: remove relevant object and binary files"
	@echo "    realclean: remove all object and binary files for Finesse,"
	@echo "         libraries, and documentation"
	@echo "    help: print this information to the screen"

# vim: shiftwidth=4: