Merge "Support BuildFlags: nocumulaterpms" into devel
[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             debtransformxz \
48             debtransformzip \
49             mkbaselibs \
50             mkdrpms \
51             listinstalled \
52             createzyppdeps \
53             createarchdeps \
54             createdebdeps \
55             createrepomddeps \
56             createyastdeps \
57             changelog2spec \
58             spec2changelog \
59             download \
60             runservices \
61             spec_add_patch \
62             spectool \
63             signdummy \
64             unrpm \
65             telnet_login_wrapper \
66             $(DESTDIR)$(pkglibdir)
67         install -m755 emulator/emulator.sh $(DESTDIR)$(pkglibdir)/emulator/
68         install -m644 Build/*.pm $(DESTDIR)$(pkglibdir)/Build
69         install -m644 qemu-reg $(DESTDIR)$(pkglibdir)
70         install -m644 build-vm build-vm-* $(DESTDIR)$(pkglibdir)
71         install -m644 build-recipe build-recipe-* $(DESTDIR)$(pkglibdir)
72         install -m644 build-pkg build-pkg-* $(DESTDIR)$(pkglibdir)
73         install -m644 *.pm baselibs_global*.conf lxc.conf $(DESTDIR)$(pkglibdir)
74         install -m644 configs/* $(DESTDIR)$(pkglibdir)/configs
75         install -m644 build.1 $(DESTDIR)$(man1dir)
76         install -m644 vc.1 $(DESTDIR)$(man1dir)
77         install -m644 unrpm.1 $(DESTDIR)$(man1dir)
78         ln -sf $(pkglibdir)/build $(DESTDIR)$(bindir)/build
79         ln -sf $(pkglibdir)/vc    $(DESTDIR)$(bindir)/buildvc
80         ln -sf $(pkglibdir)/unrpm $(DESTDIR)$(bindir)/unrpm
81
82 # Allow initvm to be packaged seperately from the rest of build.  This
83 # is useful because it is distributed as a static binary package (e.g.
84 # build-initvm-static) whereas the build scripts package is noarch.
85
86 initvm: initvm.c
87         $(CC) -o $@.$(INITVM_ARCH) -static $(CFLAGS) initvm.c
88
89 initvm-all: initvm
90
91 initvm-build: initvm
92
93 initvm-install: initvm
94         install -m755 -d $(DESTDIR)$(pkglibdir)
95         install -m755 initvm.$(INITVM_ARCH) $(DESTDIR)$(pkglibdir)/initvm.$(INITVM_ARCH)
96
97
98 dist:
99 ifeq ($(SCM),svn)
100         rm -rf $(BUILD)-$(VERSION)$(SVNVER)
101         svn export . $(BUILD)-$(VERSION)$(SVNVER)
102         tar --force-local -cjf $(BUILD)-$(VERSION)$(SVNVER).tar.bz2 $(BUILD)-$(VERSION)$(SVNVER)
103         rm -rf $(BUILD)-$(VERSION)$(SVNVER)
104 else
105 ifeq ($(SCM),git)
106         git archive --prefix=$(BUILD)-$(VERSION)_git$(DATE)/ HEAD| bzip2 > $(BUILD)-$(VERSION)_git$(DATE).tar.bz2
107 endif
108 endif