346a9086cc17d0ed70ab0d8babe415620668b4b4
[tools/build.git] / Makefile
1 VERSION=0.1
2 SCM=$(shell if test -d .svn; then echo svn; elif test -d .git; then echo git; fi)
3 DATE=$(shell date +%Y%m%d%H%M)
4 BUILD=build
5
6 INITVM_ARCH=$(shell bash -c '. common_functions ; build_host_arch; echo $$BUILD_INITVM_ARCH')
7
8 ifeq ($(SCM),svn)
9 SVNVER=_SVN$(shell LANG=C svnversion .)
10 endif
11
12 prefix=/usr
13 bindir=$(prefix)/bin
14 datadir=$(prefix)/share
15 libdir=$(prefix)/lib
16 pkglibdir=$(libdir)/$(BUILD)
17 mandir=$(datadir)/man
18 man1dir=$(mandir)/man1
19 sysconfdir=/etc
20 DESTDIR=
21
22 all:
23
24 install:
25         install -m755 -d \
26             $(DESTDIR)$(pkglibdir)/configs \
27             $(DESTDIR)$(pkglibdir)/Build \
28             $(DESTDIR)$(pkglibdir)/emulator \
29             $(DESTDIR)$(bindir) \
30             $(DESTDIR)$(man1dir)
31         install -m755 \
32             build \
33             vc \
34             createdirdeps \
35             order \
36             expanddeps \
37             computeblocklists \
38             extractbuild \
39             getbinaryid \
40             killchroot \
41             queryconfig \
42             common_functions \
43             init_buildsystem \
44             substitutedeps \
45             debtransform \
46             debtransformbz2 \
47             debtransformzip \
48             mkbaselibs \
49             mkdrpms \
50             listinstalled \
51             createzyppdeps \
52             createarchdeps \
53             createdebdeps \
54             createrepomddeps \
55             createyastdeps \
56             changelog2spec \
57             spec2changelog \
58             download \
59             spec_add_patch \
60             spectool \
61             signdummy \
62             unrpm \
63             $(DESTDIR)$(pkglibdir)
64         install -m755 emulator/emulator.sh $(DESTDIR)$(pkglibdir)/emulator/
65         install -m644 Build/*.pm $(DESTDIR)$(pkglibdir)/Build
66         install -m644 qemu-reg $(DESTDIR)$(pkglibdir)
67         install -m644 build-vm build-vm-* $(DESTDIR)$(pkglibdir)
68         install -m644 build-recipe build-recipe-* $(DESTDIR)$(pkglibdir)
69         install -m644 build-pkg build-pkg-* $(DESTDIR)$(pkglibdir)
70         install -m644 *.pm baselibs_global*.conf lxc.conf $(DESTDIR)$(pkglibdir)
71         install -m644 configs/* $(DESTDIR)$(pkglibdir)/configs
72         install -m644 build.1 $(DESTDIR)$(man1dir)
73         install -m644 vc.1 $(DESTDIR)$(man1dir)
74         install -m644 unrpm.1 $(DESTDIR)$(man1dir)
75         ln -sf $(pkglibdir)/build $(DESTDIR)$(bindir)/build
76         ln -sf $(pkglibdir)/vc    $(DESTDIR)$(bindir)/buildvc
77         ln -sf $(pkglibdir)/unrpm $(DESTDIR)$(bindir)/unrpm
78
79 # Allow initvm to be packaged seperately from the rest of build.  This
80 # is useful because it is distributed as a static binary package (e.g.
81 # build-initvm-static) whereas the build scripts package is noarch.
82
83 initvm: initvm.c
84         $(CC) -o $@.$(INITVM_ARCH) -static $(CFLAGS) initvm.c
85
86 initvm-all: initvm
87
88 initvm-build: initvm
89
90 initvm-install: initvm
91         install -m755 -d $(DESTDIR)$(pkglibdir)
92         install -m755 initvm.$(INITVM_ARCH) $(DESTDIR)$(pkglibdir)/initvm.$(INITVM_ARCH)
93
94
95 dist:
96 ifeq ($(SCM),svn)
97         rm -rf $(BUILD)-$(VERSION)$(SVNVER)
98         svn export . $(BUILD)-$(VERSION)$(SVNVER)
99         tar --force-local -cjf $(BUILD)-$(VERSION)$(SVNVER).tar.bz2 $(BUILD)-$(VERSION)$(SVNVER)
100         rm -rf $(BUILD)-$(VERSION)$(SVNVER)
101 else
102 ifeq ($(SCM),git)
103         git archive --prefix=$(BUILD)-$(VERSION)_git$(DATE)/ HEAD| bzip2 > $(BUILD)-$(VERSION)_git$(DATE).tar.bz2
104 endif
105 endif