File: rules

package info (click to toggle)
via 1.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,480 kB
  • ctags: 2,266
  • sloc: ansic: 30,757; makefile: 101; sh: 46
file content (154 lines) | stat: -rwxr-xr-x 4,017 bytes parent folder | download
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
154
#!/usr/bin/make -f
# -*- makefile -*-

# This has to be exported to make some magic below work.
export DH_OPTIONS

DEB_BUILD_PATH=build

export CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	export CFLAG += -O0
else
	export CFLAGS += -O2
endif

CMAKE_FLAGS=-DCMAKE_INSTALL_PREFIX:PATH=/usr \
            -DCMAKE_SKIP_RPATH:BOOL=ON \
            -DBUILD_VX:BOOL=ON \
            -DBUILD_VXVIEW:BOOL=ON \
            -DBUILD_APPS:BOOL=ON \
            -DCMAKE_C_FLAGS:STRING="$$CFLAGS" \
            -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined" \
            -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined"

clean:
	dh_testdir
	
	# Add here commands to clean up after the build process.
	rm -rf $(DEB_BUILD_PATH)
	
	rm -f build-stamp
	rm -f configure-stamp
	dh_clean 

configure: configure-stamp
configure-stamp:
	dh_testdir
	
	if [ ! -d $(DEB_BUILD_PATH) ]; then mkdir $(DEB_BUILD_PATH); fi
	
	cd $(DEB_BUILD_PATH) \
		&& cmake $(CURDIR) $(CMAKE_FLAGS)
	touch configure-stamp

build: build-stamp
build-stamp: configure
	dh_testdir
	dh_clean -k 
	dh_installdirs
	
	cd $(DEB_BUILD_PATH) && $(MAKE) VERBOSE=1
	
	touch build-stamp


install: build
	dh_testdir
	dh_testroot
	dh_clean -k -s
	dh_installdirs -s
	
	# install binaries and shared libs
	cd $(DEB_BUILD_PATH) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	
	# grab all handwritten manpages, be careful to exclude matches in quilt
	# data
	mkdir -p $(CURDIR)/debian/tmp/man
	for i in $$(find . -name '*.man' | grep -v '^\./\.pc'); do \
		cp -v $$i debian/tmp/man/$$(basename $${i%.man}.1); \
	done
	
	# generate missing manpages with doxygen
	# first update doxygen config
	cp $(CURDIR)/userdoc/Doxyfile debian/tmp/man/Doxyfile.old
	doxygen -u debian/tmp/man/Doxyfile.old
	sed -e 's#/home/dallas1/lohmann/VIA/pgms \\#$(CURDIR)/pgms#g' \
		-e 's#/home/dallas1/lohmann/VIA/base##g' \
		-e 's/GENERATE_HTML          = YES/GENERATE_HTML = NO/g' \
		-e 's/GENERATE_LATEX         = YES/GENERATE_LATEX = NO/g' \
		< debian/tmp/man/Doxyfile.old > debian/tmp/man/Doxyfile
	# run doxygen
	cd debian/tmp/man && doxygen
	# turn man3 into man1
	for m in debian/tmp/man/man/man3/*; do \
		app=$$(basename $$m) ; \
		app=$${app%.c.3} ; \
		if [ -x $(CURDIR)/debian/tmp/usr/bin/$${app} ]; then \
			echo "Converting manpage of $${app}" ; \
			sed -e "s/.TH \"$${app}.c\" 3 /.TH \"$${app}\" 1 /g" \
			    -e "s/$${app}.c/$${app}/g" \
				< $$m > debian/tmp/man/man/$${app}.1 ; \
		fi ; \
	done
	
	# only add generated manpages if no handwritten is available
	for m in $(CURDIR)/debian/tmp/man/man/*.1; do \
		if [ ! -f $(CURDIR)/debian/tmp/man/$$(basename $$m) ]; then \
			cp -v $$m $(CURDIR)/debian/tmp/man/$$(basename $$m); \
		fi; \
	done
	
	# generate API docs with doxygen
	# first update doxygen config
	mkdir -p $(CURDIR)/debian/tmp/api
	cp $(CURDIR)/doc/Doxyfile debian/tmp/api/Doxyfile.old
	sed -e 's#/home/dallas1/lohmann/VIA/vialib /home/dallas1/lohmann/VIA/include#../../../vialib ../../../vxlib ../../../viaio ../../../include#g' \
		-e 's/GENERATE_MAN          = YES/GENERATE_MAN = NO/g' \
		-e 's/GENERATE_LATEX         = YES/GENERATE_LATEX = NO/g' \
		< debian/tmp/api/Doxyfile.old > debian/tmp/api/Doxyfile
	# run doxygen
	doxygen -u debian/tmp/api/Doxyfile
	cd debian/tmp/api && doxygen




# Must not depend on anything. This is to be called by
# # binary-arch/binary-indep
# # in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_install --sourcedir=$(CURDIR)/debian/tmp
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb


# Build architecture-independent files here.
binary-indep: install
	
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common


# Build architecture-dependent files here.
binary-arch: install
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common


binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary configure