File: rules

package info (click to toggle)
ngspice 24-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 46,840 kB
  • sloc: ansic: 456,450; xml: 13,667; sh: 10,075; makefile: 3,407; perl: 1,590; yacc: 1,486; tcl: 823; pascal: 702; lex: 319
file content (192 lines) | stat: -rwxr-xr-x 6,178 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif



config.status: config.status-stamp configure
config.status-stamp:
	dh_testdir
	# Make build dir for ngspice
	mkdir -p build/ngspice
	cp -Rl `ls . |grep -v build|grep -v debian` build/ngspice
	cp -f /usr/share/misc/config.sub build/ngspice/config.sub
	cp -f /usr/share/misc/config.guess build/ngspice/config.guess
	#cp -f /usr/share/misc/config.sub build/ngspice/doc/config.sub
	#cp -f /usr/share/misc/config.guess build/ngspice/doc/config.guess
	cp -a manual build/
	# Make build dir for tclspice
	mkdir -p build/tclspice
	cp -Rl `ls . |grep -v build|grep -v debian` build/tclspice
	cp -f /usr/share/misc/config.sub build/tclspice/config.sub
	cp -f /usr/share/misc/config.guess build/tclspice/config.guess
	# Configure ngspice
	(cd build/ngspice;\
	./configure $(CROSS) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--enable-maintainer-mode \
		--with-editline=yes \
		--enable-xspice \
		--enable-cider \
		--disable-debug \
		CFLAGS="$(CFLAGS)")
	#LDFLAGS="-Wl,-z,defs")
	# Configure tclspice
	(cd build/tclspice;\
	./configure $(CROSS) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--libdir=/usr/lib/tcltk \
		--enable-shared=yes \
		--enable-maintainer-mode \
		--with-editline=no \
		--enable-xspice \
		--enable-cider \
		--disable-debug \
		--disable-x \
		--with-tcl=/usr/lib/tcl8.4 \
		CFLAGS="$(CFLAGS)")
	touch $@

build: build-arch build-indep

build-arch: config.status 
	dh_testdir
	cd build/ngspice && $(MAKE)
	cd build/tclspice && $(MAKE)
	touch $@

build-indep: config.status
	# Build documentation
	dh_testdir
	cd build/manual && lyx --export ps manual.lyx 
	cd build/manual && lyx --export html manual.lyx 
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp 
	rm -f config.status-stamp
	rm -rf build
	rm -f src/frontend/parse-bison.c
	rm -f src/frontend/parse-bison.h
	rm -f config.guess
	rm -f config.sub
	rm -f *-indep *-arch
	dh_clean 

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Make ngspice and tclspice
	# tclspice must be installed prior to ngspice. Some files will be overwritten by ngspice
	# but the ngspice are the correct ones.
	cd build/tclspice && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install 
	cd build/ngspice && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
	# The code model files must be stripped
ifneq ("nostrip","$(findstring nostrip,$(DEB_BUILD_OPTIONS))")
	strip $(CURDIR)/debian/tmp/usr/lib/ngspice/*.cm
	strip $(CURDIR)/debian/tmp/usr/lib/tcltk/ngspice/*.cm
endif

	# Remove empty dirs:
	find $(CURDIR)/debian/tclspice -type d -empty -delete
	touch $@

install-indep: build-indep
	# Documentation for ngspice, the same as for tclspice
	mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/html
	cp -a build/manual/manual.html.LyXconv/* \
		$(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/html
	install -o root -g root -m 644 build/manual/manual.ps \
		$(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/ngspice.ps
	# Removing /usr/share/info directory
	rm -rf $(CURDIR)/debian/tmp/usr/share/info
	chmod a-x $(CURDIR)/build/tclspice/examples/tclspice/*/*.tcl
	chmod a+x $(CURDIR)/build/tclspice/examples/tclspice/tcl-testbench*/tcl-testbench*.tcl \
		$(CURDIR)/build/tclspice/examples/tclspice/tcl/test_vectoblt.tcl
	mkdir -p build/ngspice/examples/xspice1/
	cp -a src/xspice/examples/* build/ngspice/examples/xspice1/
	find build/ngspice/examples/xspice1/ -name Makefile -exec rm -f {} \;
	find build/ngspice/examples/xspice1/ -type f -exec chmod a-x {} \;
	touch $@

# Build architecture-independent files here.
binary-indep: install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_install -i --sourcedir=debian/tmp
	dh_installman -i
	dh_installexamples -i -pngspice-doc build/ngspice/examples/* -Xtclspice
	dh_installchangelogs ChangeLog -i
	dh_compress -i --exclude=.tcl --exclude=.cir
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs ChangeLog -a
	dh_installdocs -pngspice contrib -XCOPYING -a
	dh_installdocs
	dh_installexamples -ptclspice build/tclspice/examples/tclspice/* -a
	dh_install --sourcedir=debian/tmp -a
	sed -i "/dependency_libs/ s/'.*'/''/" \
		"$(CURDIR)/debian/tclspice/usr/lib/tcltk/libspice.la"
	dh_installman -a
	dh_link -a
	dh_strip -a
	dh_compress -a --exclude=.tcl --exclude=.cir
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

#DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | grep '^Version:' | sed -e 's/Version: \(.*\)-\(.*\)\.*/\1/')
get-orig-source:
	VER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-+~]+).*,\1,p'); \
	set -e;\
	wget -q http://sourceforge.net/projects/ngspice/files/ng-spice-rework/$$VER/ngspice-$$VER.tar.gz; \
	tar xzf ngspice-$$VER.tar.gz --exclude=CVS --exclude=xgraph; \
	rm -f ngspice-$$VER/config.sub ;\
	rm -f ngspice-$$VER/config.guess ;\
	rm -rf ngspice-$$VER/examples/TransImpedanceAmp ;\
	rm -rf ngspice-$$VER/examples/tclspice\tcl-testbench3 ;\
	tar czf ngspice_$$VER.orig.tar.gz ngspice-$$VER; \
	rm -f ngspice-$$VER.tar.gz; \
	rm -rf ngspice-$$VER; \
	wget -q http://sourceforge.net/projects/ngspice/files/ng-spice-rework/$$VER/ngspice-doc-$$VER.tar.gz; \
	tar xzf ngspice-doc-$$VER.tar.gz --exclude=\*.pdf; \
	mv ngspice-doc-$$VER ngspice-$$VER; \
	tar czf ngspice_$$VER.orig-manual.tar.gz ngspice-$$VER; \
	rm -f ngspice-doc-$$VER.tar.gz; \
	rm -rf ngspice-$$VER
# 	find ${DIRNAME} -name .cvsignore -exec rm -f {} \; ;\

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