summaryrefslogtreecommitdiff
path: root/debian/rules
blob: e4cc389ba8cc388ccd2b763df879fc710a52cf4f (plain)
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
#!/usr/bin/make -f

UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p')

YACC      := YACC=/usr/bin/byacc
BOOTSTRAP := ASH=/bin/bash ECHO=/bin/echo MKDIR=/bin/mkdir CP=/bin/cp \
  RM=/bin/rm INSTALL=/usr/bin/install $(YACC)
SVNROOT   := http://svn.netlabs.org/repos/kbuild/trunk
REVISION  := $(shell echo $(UPSTREAM_VERSION) | sed -e's,.*svn,,')

export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed

%:
	dh $@

override_dh_auto_configure:
	echo "KBUILD_SVN_URL := $(SVNROOT)"  >  SvnInfo.kmk
	echo "KBUILD_SVN_REV := $(REVISION)" >> SvnInfo.kmk

override_dh_auto_build:
	$(info DEBUG: macros defined by gcc:)
	-gcc -dM -E - < /dev/null
	kBuild/env.sh --full make -f bootstrap.gmk SRCDIR=`pwd` $(BOOTSTRAP)
	kBuild/env.sh kmk rebuild PATH_INS=`pwd` KBUILD_VERBOSE=2 $(YACC)

override_dh_auto_install:
	kBuild/env.sh kmk install NIX_INSTALL_DIR=/usr KBUILD_VERBOSE=2 LDFLAGS=-Wl,--as-needed

override_dh_auto_clean:
	-kBuild/env.sh kmk uninstall
	rm -rf debian/stamp-* out kBuild/bin/*/* SvnInfo.kmk
	( cd src/kmk; rm -f aclocal.m4 config.h.in configure Makefile.in )
	( cd src/kmk/config; rm -f compile config.guess config.sub depcomp install-sh Makefile.in missing )
	rm -f src/kmk/glob/Makefile.in src/kmk/w32/Makefile.in
	( cd src/sed/config; rm -f intdiv0.m4 intmax.m4 inttypes_h.m4 inttypes.m4 inttypes-pri.m4 isc-posix.m4 longdouble.m4 longlong.m4 mkinstalldirs nls.m4 po.m4 printf-posix.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4 )
	( cd src/sed/intl; rm -f libgnuintl.h.in localcharset.h log.c printf-args.c printf-args.h printf.c printf-parse.c printf-parse.h relocatable.c relocatable.h vasnprintf.c vasnprintf.h vasnwprintf.h wprintf-parse.h xsize.h )
	( cd src/sed/po; rm -f Makevars.template remove-potcdate.sin )

get-orig-info:
	svn info $(SVNROOT)

get-orig-source:
	sh debian/orig-tar.sh $(SVNROOT) $(UPSTREAM_VERSION) $(REVISION)