File: rules

package info (click to toggle)
libgdchart-gd1 0.10.1dev-10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 260 kB
  • ctags: 327
  • sloc: ansic: 3,885; makefile: 126
file content (124 lines) | stat: -rwxr-xr-x 3,853 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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2003 Jonas Smedegaard <dr@jones.dk>

#include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/class/makefile.mk

PACKAGE=libgdchart-gd1
LIBRARY=libgdchart

VERSION=$(shell expr `pwd` : '.*-\([0-9.]*\)')
VERSION_MAJOR=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')

BUILD-ARCH-TARGETS = build-$(PACKAGE)-xpm build-$(PACKAGE)-noxpm

STAMP-ARCH-TARGETS = $(patsubst build-%,stamp-%,$(BUILD-ARCH-TARGETS))
BINARY-ARCH-TARGETS = $(patsubst build-%,binary-%,$(BUILD-ARCH-TARGETS))

build: $(BUILD-ARCH-TARGETS)

CFLAGS = -Wall -g -D_REENTRANT -pipe -DHAVE_LIBPNG -DHAVE_LIBFREETYPE -DHAVE_LIBJPEG -fsigned-char
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
INCLUDEDIRS=-I. -I.. -I/usr/include/freetype2
LIBS=-lc -lm -L/usr/lib -lpng -lz -ljpeg -lfreetype -lgd

# Build shared libc6 library.
build-$(PACKAGE)-xpm: stamp-$(PACKAGE)-xpm
stamp-$(PACKAGE)-xpm:
	make clean
	dh_testdir
	-mkdir build-xpm
	# Build static library with -fPIC
	cd build-xpm && \
		$(MAKE) -f ../makefile VPATH=".." srcdir=".." CFLAGS="$(CFLAGS) -DHAVE_XPM -fPIC" INCLUDEDIRS="$(INCLUDEDIRS) -I/usr/include/X11" $(LIBRARY).a
	# Build shared library
	cd build-xpm && \
		gcc -shared -D_REENTRANT -Wl,-soname,$(LIBRARY).so.$(VERSION_MAJOR) -o $(LIBRARY).so.$(VERSION) `echo *.o` $(LIBS) -L/usr/X11R6/lib -lXpm -lX11
	# Rebuild static library non-PIC
	cd build-xpm && \
		$(MAKE) -f ../makefile VPATH=".." srcdir=".." CFLAGS="$(CFLAGS) -DHAVE_XPM" INCLUDEDIRS="$(INCLUDEDIRS) -I/usr/include/X11" $(LIBRARY).a
	touch $@

# Build shared libc6 library without XPM support.
build-$(PACKAGE)-noxpm: stamp-$(PACKAGE)-noxpm
stamp-$(PACKAGE)-noxpm:
	make clean
	dh_testdir
	-mkdir build-noxpm
	# Build non-xpm static library with -fPIC
	cd build-noxpm && \
		$(MAKE) -f ../makefile VPATH=".." srcdir=".." CFLAGS="$(CFLAGS) -fPIC" INCLUDEDIRS="$(INCLUDEDIRS)" $(LIBRARY).a
	# Build shared library
	cd build-noxpm && \
		gcc -shared -D_REENTRANT -Wl,-soname,$(LIBRARY).so.$(VERSION_MAJOR) -o $(LIBRARY).so.$(VERSION) `echo *.o` $(LIBS)
	# Rebuild static library non-PIC
	cd build-noxpm && \
		$(MAKE) -f ../makefile VPATH=".." srcdir=".." CFLAGS="$(CFLAGS) INCLUDEDIRS="$(INCLUDEDIRS) $(LIBRARY).a
	touch $@

clean:
	make clean
	dh_testdir
	dh_testroot
	rm -rf $(STAMP-ARCH-TARGETS)
	rm -rf build-xpm build-noxpm
	dh_clean

	echo "build-xpm/$(LIBRARY).so.$(VERSION) /usr/lib" > debian/$(PACKAGE)-xpm.install
	echo "build-noxpm/$(LIBRARY).so.$(VERSION) /usr/lib" > debian/$(PACKAGE)-noxpm.install
	echo "/usr/lib/$(LIBRARY).so.$(VERSION) /usr/lib/$(LIBRARY).so.$(VERSION_MAJOR)" > debian/$(PACKAGE)-xpm.links
	echo "/usr/lib/$(LIBRARY).so.$(VERSION) /usr/lib/$(LIBRARY).so.$(VERSION_MAJOR)" > debian/$(PACKAGE)-noxpm.links
	echo "/usr/lib/$(LIBRARY).so.$(VERSION) /usr/lib/$(LIBRARY).so" > debian/$(PACKAGE)-xpm-dev.links
	echo "/usr/lib/$(LIBRARY).so.$(VERSION) /usr/lib/$(LIBRARY).so" > debian/$(PACKAGE)-noxpm-dev.links

	chmod -R a=r,a+X,u+w *
	chmod a+x debian/rules

binary-indep: build

binary-arch: build $(BINARY-ARCH-TARGETS)

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	dh_install

binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs -A README
	dh_installexamples
	dh_installman
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs -V"$(PACKAGE)-noxpm | $(PACKAGE)-xpm"
	dh_buildinfo
	dh_installdeb
	dh_perl
	dh_shlibdeps -ldebian/$(PACKAGE)-noxpm/usr/lib
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep: build install

binary-arch: build install
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common

binary-%: build install
	make -f debian/rules binary-common DH_OPTIONS=-p$*

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