File: rules

package info (click to toggle)
libwn6 6.0-17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 6,012 kB
  • ctags: 3,903
  • sloc: ansic: 45,078; makefile: 960; csh: 274; sh: 17
file content (169 lines) | stat: -rwxr-xr-x 5,694 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,       -*- makefile -*-
# based on the sample debian/rules file for GNU hello by Ian Jackson.


# this does not work
# VERSION=$(expr `pwd` : '.*-\([0-9.]*\)')
# MAJOR=$(expr `pwd` : '.*-\([0-9]*\).[0-9.]*')
VERSION=6.0
MAJOR=6
package=libwn$(MAJOR)

# build without debugging symbols and strip executables when installing,
# unless DEB_BUILD_OPTIONS specifies otherwise
INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_LIB     = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755

          ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
          CFLAGS += -O0
          else
          CFLAGS += -O2
          endif
ADDCFLAGS=-D_REENTRANT -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  ADDCFLAGS += -O0
else
  ADDCFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  INSTALL_PROGRAM += -s
  INSTALL_LIB += -s
endif


DOC=debian/libwn-dev/usr/share/doc/libwn-dev
DEV=debian/libwn-dev
TESTDIR=$(DEV)/usr/lib/debian-test/tests/libwn-dev

build:build-stamp
build-stamp:
	$(checkdir)
	# build first time with -fPIC to get the shared library
	make MAJOR=$(MAJOR) VERSION=$(VERSION) ADDCFLAGS='$(ADDCFLAGS) -fPIC'
	# repeat the build without -fPIC for the static library
	make MAJOR=$(MAJOR) VERSION=$(VERSION) ADDCFLAGS='$(ADDCFLAGS)'
	touch build-stamp

clean:
	$(checkdir)
	-rm -rf static shared
	-rm -f build-stamp
	-make clean
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
	-rm -f acc/libwn.so.*
	-rm -f debian/*substvars

binary-indep: checkroot build-stamp
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: checkroot build-stamp
	$(checkdir)
	#
	#	First, libwn.so.6
	#
	-rm -rf debian/tmp
	${INSTALL_DIR} debian/tmp
	cd debian/tmp && ${INSTALL_DIR} `cat ../dirs`
	${INSTALL_DIR} debian/tmp/usr/share/doc/libwn$(MAJOR)
	#
	#	 install -o root -m 755 debian/postinst debian/tmp/DEBIAN
	#	 install -o root -m 755 debian/shlibs debian/tmp/DEBIAN
	${INSTALL_LIB} acc/libwn.so.$(VERSION) debian/tmp/usr/lib
	#	ln -s libwn.so.$(VERSION) debian/tmp/usr/lib/libwn.so.$(MAJOR)
	#	 install -o root -m 644 debian/changelog \
	#		 debian/tmp/usr/share/doc/libwn$(MAJOR)/changelog
	#	 gzip -9f debian/tmp/usr/share/doc/libwn$(MAJOR)/*
	#	 install -o root -m 644 debian/copyright \
	#		 debian/tmp/usr/share/doc/libwn$(MAJOR)/copyright
	#	 dpkg-shlibdeps libwn.so.$(VERSION)
	#	 dpkg-gencontrol -plibwn$(MAJOR) -Pdebian/tmp
	#	 dpkg --build debian/tmp ..
	#
	#	Now build libwn-dev
	#
	-rm -rf debian/libwn-dev
	cd debian/tmp && ${INSTALL_DIR} `cat ../libwn-dev.dirs`
	${INSTALL_DIR} debian/libwn-dev
	${INSTALL_DIR} debian/libwn-dev/DEBIAN
	${INSTALL_DIR} debian/libwn-dev/usr/lib
	${INSTALL_DIR} debian/libwn-dev/usr/include/wn
	${INSTALL_DIR} debian/libwn-dev/usr/share/man/man3
	${INSTALL_DIR} debian/libwn-dev/usr/share/doc/libwn-dev
#	${INSTALL_DIR} debian/libwn-dev/usr/share/doc/libwn-dev/examples

	for d in anneal arg btr cmp complex conjdir cpy hash list low	\
	mat mem misc parse random sort spmat str vect; do		\
	  ${INSTALL_DIR} $(DOC)/examples/$$d;				\
	done
	cd acc; for p in */example*.c; do				\
	  sed -e 's,^#include "wn,#include <wn/wn,' -e 's,.h",.h>,' $$p	\
	    >../$(DOC)/examples/$$p;					\
	done; cd ..
	${INSTALL_DIR} ${TESTDIR}
	for d in  btr cmp hash low mem; do			\
	  sed -e 's,^#include "wn,#include <wn/wn,'		\
	      -e 's,.h",.h>,'					\
	      -e 's/^void main/int main/'			\
	      -e 's/fprintf(stderr/fprintf(stdout/'		\
	      acc/$$d/selftest.c >${TESTDIR}/$$d-selftest.c;	\
	done
	install debian/test-1 ${TESTDIR}/test-1
	${INSTALL_FILE} debian/copyright             $(DOC)/copyright
	${INSTALL_FILE} debian/README.debian         $(DOC)/README.debian
	${INSTALL_FILE} debian/changelog             $(DOC)/changelog.Debian
	${INSTALL_FILE} debian/README.examples       $(DOC)/examples/README
	${INSTALL_FILE} doc/papers/heisen.bug        $(DOC)/heisen.bug
	${INSTALL_FILE} doc/papers/memory_paper.txt  $(DOC)/memory_paper.txt
	#
	install -m 644 acc/text.a debian/libwn-dev/usr/lib/$(package).a
	# the script hscript.csh has already linked all the header files
	# from other directories into acc/h
	install -m 644 `ls acc/h/*.h` debian/libwn-dev/usr/include/wn/
	# remove the undocumented one
	rm debian/libwn-dev/usr/include/wn/resnet.h
	ln -s libwn.so.$(VERSION) debian/libwn-dev/usr/lib/libwn.so
	install -m 644 `ls acc/*/*.3|egrep -v '(cmp/wn_memcmp|cpy/wn_stracpy|cpy/wn_memcpy|cmp/wn_memeq)'` debian/libwn-dev/usr/share/man/man3/
	#	 ${INSTALL_FILE} debian/changelog \
	#		 $(DOC)/changelog
	#	 gzip -9f $(DOC)/*
	#	 ${INSTALL_FILE} COPYRIGHT \
	#		 $(DOC)/copyright
	#	 gzip -9f debian/libwn-dev/usr/share/man/*/*
	#	 dpkg-gencontrol -plibwn-dev -Pdebian/libwn-dev
	#	 dpkg --build debian/libwn-dev ..
	#
	#make install DESTDIR=`pwd`/debian/libwn-dev
	# 
	# 	  Now make both packages
	# 
	debstd -m README INSTALL
	dpkg-gencontrol -isp -plibwn-dev -Pdebian/libwn-dev
	#	 chown -R root.root debian/libwn-dev
	#	 chmod -R go=rX debian/libwn-dev
	dpkg --build debian/libwn-dev ..
	#
	dpkg-shlibdeps acc/libwn.so.$(VERSION)
	dpkg-gencontrol -plibwn$(MAJOR) -Pdebian/tmp
	dpkg --build debian/tmp ..


define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot