File: rules

package info (click to toggle)
glide 2002.04.10ds1-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 58,712 kB
  • ctags: 58,934
  • sloc: ansic: 290,120; asm: 23,271; sh: 8,117; pascal: 3,854; makefile: 1,298; perl: 168
file content (137 lines) | stat: -rwxr-xr-x 3,574 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
#!/usr/bin/make -f

#export DH_VERBOSE = 1

export FX_GLIDE_PIC = 1

glide2_build := $(MAKE) -C $(CURDIR)/glide2x -f makefile.linux
define glide3_build
( \
  cd $(CURDIR)/glide3x; \
  mkdir $(CURDIR)/debian/tmp.$(1); \
  ./chores.3dfx --generate "--configure=--enable-fx-glide-hw=$(1) \
    --prefix=/usr" --build-dir=build.$(1); \
  cd build.$(1); \
  ./build.3dfx --no-x DESTDIR="$(CURDIR)/debian/tmp.$(1)/" \
    CFLAGS="$(CFLAGS)" install; \
)
endef

pkg_dir := $(CURDIR)/debian

libglide2_dir := $(pkg_dir)/libglide2
libglide3_dir := $(pkg_dir)/libglide3

INSTALL=install
INSTALL_LIB=$(INSTALL) -m 644

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

CFLAGS = -g -Wall

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -O0
else
ifeq ($(DEB_HOST_ARCH),alpha)
  CFLAGS += -O2 -mcpu=ev5 -fomit-frame-pointer \
	    -fexpensive-optimizations -mieee -DBIG_OPT
else
ifeq ($(DEB_HOST_ARCH),i386)
  CFLAGS += -O3 -march=i486 -fomit-frame-pointer -funroll-loops \
	    -fexpensive-optimizations -ffast-math -DBIG_OPT
else
  CFLAGS += -O2 -fomit-frame-pointer -fexpensive-optimizations -ffast-math \
	    -DBIG_OPT
endif
endif
endif

debian/po/templates.pot: debian/libglide2.templates debian/libglide3.templates
	@debconf-updatepo

build: build.stamp
build.stamp: debian/po/templates.pot
ifeq ($(DEB_HOST_ARCH),i386)
	ln -fs ../swlibs glide2x/
	$(glide2_build) FX_GLIDE_HW=cvg CNODEBUG="$(CFLAGS)"
	$(glide2_build) FX_GLIDE_HW=h3 CNODEBUG="$(CFLAGS)"
endif
	ln -fs ../swlibs glide3x/
	$(call glide3_build,h3)
	$(call glide3_build,h5)
	
	touch $@

clean:
ifeq ($(DEB_HOST_ARCH),i386)
	ln -fs ../swlibs glide2x/
	$(glide2_build) FX_GLIDE_HW=cvg clobber
	$(glide2_build) FX_GLIDE_HW=h3 clobber
	rm -f glide2x/swlibs
endif
	ln -fs ../swlibs glide3x/
	cd $(CURDIR)/glide3x; ./chores.3dfx --clean
	rm -f glide3x/swlibs
	
	rm -rf $(CURDIR)/glide3x/build.h3 $(CURDIR)/debian/tmp.h3
	rm -rf $(CURDIR)/glide3x/build.h5 $(CURDIR)/debian/tmp.h5
	rm -f *.stamp
	
	dh_clean

binary: binary-indep binary-arch

binary-indep:
	# Nothing to do.

binary-arch: build
	dh_testdir
	dh_testroot
	dh_prep -s
	
	dh_installdirs -s
	
	# libglide2
ifeq ($(DEB_HOST_ARCH),i386)
	$(INSTALL_LIB) $(CURDIR)/glide2x/cvg/lib/libglide.so.2.53 \
		       $(libglide2_dir)/usr/lib/glide2/libglide_cvg.so.2.53
	$(INSTALL_LIB) $(CURDIR)/glide2x/h3/lib/libglide.so.2.60 \
		       $(libglide2_dir)/usr/lib/glide2/libglide_h3.so.2.60
	$(INSTALL_LIB) $(CURDIR)/glide2x/swlibs/lib/libtexus.so.1.1 \
		       $(libglide2_dir)/usr/lib/
endif
	
	# libglide3
	$(INSTALL_LIB) $(CURDIR)/debian/tmp.h3/usr/lib/libglide3.so.3.10.0 \
		       $(libglide3_dir)/usr/lib/glide3/libglide3_h3.so.3.10.0
	$(INSTALL_LIB) $(CURDIR)/debian/tmp.h5/usr/lib/libglide3.so.3.10.0 \
		       $(libglide3_dir)/usr/lib/glide3/libglide3_h5.so.3.10.0
	
	dh_install -s
	dh_installdocs -s
	dh_installchangelogs -s
	dh_installdebconf -s
	
	dh_lintian -s
	dh_link -s
	dh_strip -s
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -s
	dh_installdeb -s
	
	dh_shlibdeps -s -Nglide2-bin -Nglide3-bin
	# XXX: We use $(CURDIR) instead of $(libglide2_dir) because we do not
	# ship in the .deb the symlink to the hardware specific library.
	# XXX: dh_shlibdeps forces the -l argument to be an absolute path
	# breaking the build, so pass LD_LIBRARY_PATH directly.
	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/glide2x/h3/lib \
	  dh_shlibdeps -pglide2-bin -Llibglide2
	#dh_shlibdeps -pglide3-bin -Llibglide3 -l$(libglide3_dir)/usr/lib/
	
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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