File: rules

package info (click to toggle)
intel2gas 1.3.3-17
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 468 kB
  • sloc: cpp: 1,286; makefile: 90
file content (72 lines) | stat: -rwxr-xr-x 2,443 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
DOCDIR=debian/tmp/usr/share/doc/intel2gas

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
CXXFLAGS += -O0
else
CFLAGS += -O2
CXXFLAGS += -O2
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
     INSTALL_OPTS += -s
endif

BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')

build-arch: build
build-indep: build

build:
	if [ ! -f debian/rules ]; then echo "wrong dir!"; exit 1; fi
	./configure --prefix=/usr 
	$(MAKE) CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" INSTALL_OPTS="$(INSTALL_OPTS)"
	touch build

clean:
	if [ ! -f debian/rules ]; then echo "wrong dir!"; exit 1; fi
	-rm -f build
	 [ ! -f Makefile ] || $(MAKE) distclean
	-rm -rf debian/tmp debian/files* debian/substvars

binary-indep: build
	if [ ! -f debian/rules ]; then echo "wrong dir!"; exit 1; fi
	if [ $$(id -u) != 0 ]; then echo "not root!"; exit 1; fi

binary-arch: build
	if [ ! -f debian/rules ]; then echo "wrong dir!"; exit 1; fi
	if [ ! `id -ru` = 0 ]; then echo "not root!"; exit 1; fi
	-rm -rf debian/tmp
	install -d -m 755 -o root -g root debian/tmp debian/tmp/DEBIAN \
	$(DOCDIR) debian/tmp/usr/share/man/man1
	$(MAKE) install prefix=debian/tmp/usr INSTALL_OPTS="$(INSTALL_OPTS)"
# fix weird permissions inherited from upstream...
	chmod -R 0644 debian/tmp/usr/share/intel2gas/*/*
	install -p -o root -g root -m 644 debian/copyright README BUGS \
	DATAFILES TODO THANKS $(DOCDIR)
	install -p -o root -g root -m 644 debian/changelog \
	$(DOCDIR)/changelog.Debian
	install -p -o root -g root -m 644 ChangeLog $(DOCDIR)/changelog
# there is no proper manpage for intel2gas...i'll do a minimal one
	install -p -o root -g root -m 644 debian/intel2gas.man debian/tmp/usr/share/man/man1/intel2gas.1
	gzip -9n debian/tmp/usr/share/man/man1/intel2gas.1
# fixme: changelog and changelog.debian??
# those two are bigger than 4k...
	gzip -9n $(DOCDIR)/DATAFILES $(DOCDIR)/README $(DOCDIR)/changelog*
	dpkg-shlibdeps intel2gas
	dpkg-gencontrol -isp

	find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
	xargs -0r touch --no-dereference --date='$(BUILD_DATE)'

	dpkg --build debian/tmp ..

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean