summaryrefslogtreecommitdiff
path: root/build.mk
blob: 085c9f4d2679cd0893bdd25db730016ae7b85b00 (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
# Rules to fetch, build and install external source packages.
#
# TODO:
# - rules for pre-req dependencies
# - rules to build and maintain patches
# - rules to run tests before installing
# - build and run in chroot
# 
arc ?= $(notdir $(url)) 
dir ?= $(basename $(basename $(arc)))
configure_cmd ?= ./configure
build_cmd ?= make
install_cmd ?= sudo make install
uninstall_cmd ?= sudo make uninstall

clean:
	rm -rf .install .build .configure .extract .fetch $(dir)

debug:
	@echo arc = $(arc)
	@echo dir = $(dir)

uninstall: .install
	cd $(dir) && $(uninstall_cmd)
	rm .install

install: .install
build: .build
configure: .configure
extract: .extract
fetch: .fetch

.install: .build
	cd $(dir) && $(install_cmd)
	@touch $@

.build: .configure
	cd $(dir) && $(build_cmd)
	@touch $@

.configure: .extract
	cd $(dir) && $(configure_cmd) $(configure_flags)
	@touch $@

.extract: .fetch
	gunzip < $(arc) | tar xf -
	@touch $@

.fetch:
	curl -L $(url) -o $(arc)
	@touch $@