641313d445d90f21a8e57d8e0e6d34aae3171eee
[akaros.git] / tools / app-arch / tar / Makefile
1 include ../../Makefrag
2
3 ########## Package-specific variables
4 version := 1.29
5 src-dir = tar-$(version)
6 build-dir = $(src-dir)/build
7 tarball = tar-$(version).tar.xz
8 fetch-url = http://ftp.gnu.org/gnu/tar/$(tarball)
9 config-opts = --prefix=/usr \
10               --bindir=/bin \
11               --disable-nls \
12               --host=x86_64-ucb-akaros \
13               --build=i686-pc-linux-gnu
14
15 ########## Generic Infrastructure
16
17 PHONY := all
18 all: make
19
20 %.tar.xz:
21         $(Q)wget $(fetch-url)
22
23 akaros-patches := $(sort $(wildcard akaros-patches/$(version)/*))
24
25 $(build-dir): $(tarball) $(akaros-patches)
26         rm -fr $(src-dir)
27         tar -xf $<
28         $(Q)mkdir $(build-dir) &&                                                  \
29         for i in $(akaros-patches); do                                             \
30                 (cd $(src-dir) && patch -p1 < ../$$i);                                 \
31         done
32
33 PHONY += config
34 $(build-dir)/Makefile config: $(build-dir)
35         cd $(build-dir) && env ../configure $(config-opts)
36
37 PHONY += make
38 make: config
39         $(Q)$(MAKE) -C $(build-dir)
40
41 PHONY += install
42 install: make
43         $(Q)$(MAKE) -C $(build-dir) install-exec DESTDIR=$(KFS_ROOT)
44
45 PHONY += clean
46 clean:
47         $(Q)[ -d $(build-dir) ] &&                                                 \
48             [ -f $(build-dir)/Makefile ] &&                                        \
49             $(MAKE) -C $(build-dir) clean || true
50
51 PHONY += mrproper
52 mrproper:
53         $(Q)rm -rf $(src-dir)
54
55 .PHONY: $(PHONY)