File: rules

package info (click to toggle)
gnat-glade 2006-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,056 kB
  • ctags: 20
  • sloc: ada: 28,261; sh: 2,888; makefile: 627; ansic: 2
file content (172 lines) | stat: -rwxr-xr-x 5,001 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
#!/usr/bin/make -f

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

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

CPUS := $(shell getconf _NPROCESSORS_ONLN)

# gnatmake handles multiple jobs per the number of CPUS.  Don't do it
# from the Makefile.
.NOTPARALLEL:

VERSION := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)-\(.*\)/\1/')
REVISION := $(shell dpkg-parsechangelog | grep "^Version: " | sed 's/^Version: \(.*\)-\(.*\)/\2/')
SPECS := $(wildcard Garlic/*.ads) Garlic/s-gaplsp.ads
SPECS := $(filter-out Garlic/s-garsoc.ads,$(SPECS))
BODIES := $(wildcard Garlic/*.adb)
BODIES := $(patsubst %/5egarrem.adb,%/s-garrem.adb,$(BODIES))
ADAINCLUDE := usr/share/ada/adainclude
ADALIB := usr/lib/ada/adalib

all: build

build: pre-build patch gnatdist libgarlic.a libgarlic.so.$(VERSION).$(REVISION)

pre-build:
	dh_testdir

patch:
	-quilt push -a

unpatch:
	-quilt pop -a

gnatdist: $(wildcard Dist/*.ad[bs]) Dist/xe_defs-defaults.ads gnatdist.gpr
	: # Building gnatdist
	gnatmake -j$(CPUS) -Pgnatdist.gpr

Dist/xe_defs-defaults.ads: Dist/xe_defs-defaults.ads.in
	sed -e 's,@RSH_CMD@,rsh,' -e 's,@RSH_OPT@,-n,' \
	    -e 's,@PCSNAME@,garlic,' \
	    -e 's,@DEFSTORAGENAME@,dfs,' \
	    -e 's,@DEFSTORAGEDATA@,,' \
	    -e 's,@DEFPROTOCOLDATA@,localhost:5763,' \
	    -e 's,@DEFPROTOCOLNAME@,tcp,' \
	    -e 's,@GNAT_RTS_FLAG@,,' \
	    -e 's,@GNATDISTOPT@,O0,' \
	    -e 's,@prefix@,/usr,' < $< > $@

Garlic/s-gaplsp.ads: Garlic/s-gaplsp.ads.in
	sed -e  's,@RSH_CMD@,rsh,' -e 's,@RSH_OPT@,-n,' \
	    -e 's,@PROCESS_BLOCKING_IO@,False,' \
	    -e 's,@SUPPORT_RPC_ABORTION@,True,' \
	    -e 's,@SUPPORTS_LOCAL_LAUNCH@,True,' \
	    -e 's,@PSNAME@,linux,' \
	    -e 's,@DEFSTORAGENAME@,dfs,' \
	    -e 's,@DEFSTORAGEDATA@,,' \
	    -e 's,@DEFPROTOCOLDATA@,localhost:5763,' \
	    -e 's,@DEFPROTOCOLNAME@,tcp,' < $< > $@

make_garlic.adb: $(SPECS) $(BODIES)
	rm -f make_garlic.adb
	@echo Creating $@...
	@for i in $(SPECS); do \
	   unit=`grep -E '^(package|procedure|function)' $$i | cut -d ' ' -f 2` ; \
	   if [ ! -z $$unit ] ; then \
	      echo "with $$unit;" >> $@; \
	   fi; \
	done
	@echo "procedure make_garlic is" >> $@
	@echo "begin" >> $@
	@echo "	 null;" >> $@
	@echo "end make_garlic;" >> $@

# I would use a package Naming in garlic.gpr, but there is a bug in
# gnatmake, whereby it refuses to compile 5egarrem.adb because it is
# "a descendent of package System".  Work around that bug the ugly
# way.
Garlic/s-garrem.adb: Garlic/5egarrem.adb
	ln -s $(notdir $<) $@

libgarlic.a: make_garlic.adb $(SPECS) $(BODIES) garlic.gpr
	: # Making the static library
	-mkdir -p obj-static
	gnatmake -j$(CPUS) -a -c -Pgarlic.gpr -g -XOBJ_DIR=obj-static
	rm obj-static/make_garlic.*
	ar rc $@ obj-static/*.o
	ranlib $@

libgarlic.so.$(VERSION).$(REVISION): make_garlic.adb $(SPECS) $(BODIES)
libgarlic.so.$(VERSION).$(REVISION): garlic.gpr
	: # Making the shared library
	-mkdir -p obj-shared
	gnatmake -j$(CPUS) -a -c -Pgarlic.gpr -fPIC -XOBJ_DIR=obj-shared
	rm obj-shared/make_garlic.*
	gnatgcc -shared -o $@ obj-shared/*.o -lz -lgnat \
	   -Wl,--soname,libgarlic.so.$(VERSION)

GENERATED_FILES := Garlic/s-gaplsp.ads Garlic/s-garrem.adb Dist/xe_defs-defaults.ads 

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f libgarlic* gnatdist make_garlic.adb
	rm -f $(GENERATED_FILES)
	rm -rf obj-static obj-shared Dist/*.ali Dist/*.o
	-find Examples -name Makefile -exec rm -f {} \;
	-rm -f Examples/check-config
	dh_clean

install: build pre-install libgarlic$(VERSION) libgarlic-dev gnat-glade

pre-install:
	dh_testdir
	dh_testroot

libgarlic$(VERSION): build
	: # libgarlic2006
	dh_installdirs -p$@ usr/lib
	dh_install -p$@ libgarlic.so.$(VERSION).$(REVISION) usr/lib
	dh_link -p$@ /usr/lib/libgarlic.so.$(VERSION).$(REVISION) /usr/lib/libgarlic.so.$(VERSION)
	dh_makeshlibs -p$@

libgarlic-dev: build
	dh_installdirs -p$@ $(ADAINCLUDE)/garlic $(ADALIB)/garlic
	dh_install -p$@ Garlic/*.ad[bs] $(ADAINCLUDE)/garlic
	dh_install -p$@ libgarlic.a usr/lib
	dh_link -p$@ /usr/lib/libgarlic.so.$(VERSION).$(REVISION) /usr/lib/libgarlic.so
	dh_install -p$@ obj-shared/*.ali $(ADALIB)/garlic
	dh_install -p$@ debian/garlic.gpr $(ADAINCLUDE)
	dh_installexamples -p$@ Examples/*

gnat-glade: build
	: # gnat-glade
	dh_installdirs -p$@ usr/bin
	dh_install -p$@ gnatdist usr/bin
	dh_installman -p$@ debian/gnatdist.1

binary-indep:

binary-arch: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf	
	dh_installdocs README
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs NEWS
	dh_link
	dh_strip
	dh_compress -X.adb -X.ads -XMakefile
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: all build clean binary-indep binary-arch binary
.PHONY: pre-install patch unpatch install libgarlic$(VERSION) gnat-glade