summaryrefslogtreecommitdiffstats
path: root/dist/debian/rules
blob: 22995b676c9673d5806bc5cb1aaffb01a3aa13f9 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk

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)

ifdef KBUILD_FROM_SVN
SVNROOT   := http://svn.netlabs.org/repos/kbuild/trunk
REVISION  := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e's,.*svn,,')

makebuilddir:: SvnInfo.kmk
SvnInfo.kmk:
	echo "KBUILD_SVN_URL := $(SVNROOT)"  >  $@
	echo "KBUILD_SVN_REV := $(REVISION)" >> $@
endif

build/kbuild:: debian/stamp-build
debian/stamp-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` $(YACC)
	pod2man -c 'kBuild for Debian GNU/Linux' \
	  -r kBuild-$(DEB_UPSTREAM_VERSION) debian/kmk.pod > debian/kmk.1
	touch $@

install/kbuild::
	kBuild/env.sh kmk install NIX_INSTALL_DIR=/usr \
	  MY_INST_DOC=share/doc/kbuild/ LDFLAGS=-Wl,--as-needed

clean::
	-kBuild/env.sh kmk uninstall
	$(RM) -r debian/stamp-* debian/kmk.1 out kBuild/bin/*/*
ifdef KBUILD_FROM_SVN
	$(RM) SvnInfo.kmk
endif

## @todo fetch from ftp://ftp.netlabs.org/pub/kbuild or
## ftp://ftp.netlabs.org/incoming/kbuild when KBUILD_FROM_SVN isn't
## defined... (fetch the kBuild-x.y.z-src.tar.gz file)

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

get-orig-source:
	sh debian/orig-tar.sh $(SVNROOT) $(DEB_UPSTREAM_VERSION) $(REVISION)
else
get-orig-source:
	wget -O ../tarballs/kbuild_$(DEB_UPSTREAM_VERSION).orig.tar.gz \
	  ftp://ftp.netlabs.org/incoming/kbuild/kBuild-$(DEB_UPSTREAM_VERSION)-src.tar.gz	
endif