summaryrefslogtreecommitdiff
path: root/Makefile
blob: df7d1d8134dfff3d9df7332150f60bd88df2148d (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
57
58
59
60
61
62
63
64
65
#!/bin/make
#
# Makefile for NetSurf buildsystem
#
# Copyright 2009-2015 John-Mark Bell <jmb@netsurf-browser.org>

# Component settings
COMPONENT := buildsystem
COMPONENT_VERSION := 1.9

.PHONY:all usage install dist clean distclean test

all: usage

usage:
	@echo "make install PREFIX=/somewhere"
	@echo ""
	@echo "Will install the makefiles, and test tools into \$$PREFIX/share/netsurf-buildsystem"
	@echo ""
	@echo "Which is where the libraries etc look for it."

PREFIX?=/opt/netsurf

BASE=$(DESTDIR)$(PREFIX)/share/netsurf-buildsystem

MAKEFILES := $(patsubst %,Makefile.%,	\
	top tools subdir pkgconfig 	\
	clang gcc norcroft open64 	\
)

TESTTOOLS := testrunner.pl

CITOOLS := jenkins-build.sh

install:
	mkdir -p $(BASE)/makefiles $(BASE)/testtools $(BASE)/citools
	for M in $(MAKEFILES); do \
		cp makefiles/$$M $(BASE)/makefiles/; \
	done
	for T in $(TESTTOOLS); do \
		cp testtools/$$T $(BASE)/testtools/; \
	done
	for C in $(CITOOLS); do \
		cp citools/$$C $(BASE)/citools/; \
	done

# Distribution
# This constructs a distribution tar from the last git tag. It ensures
#   the Makefile component version matches the git tag version and the 
#   tar is apropriately named for the component being generated
dist:
	$(eval GIT_TAG := $(shell git describe --abbrev=0 --match "release/*"))
	$(eval GIT_VER := $(shell x="$(GIT_TAG)"; echo "$${x#release/}"))
	$(if $(subst $(GIT_VER),,$(COMPONENT_VERSION)), $(error Component Version "$(COMPONENT_VERSION)" and GIT tag version "$(GIT_VER)" do not match))
	$(eval DIST_FILE := $(COMPONENT)-${GIT_VER})
	$(Q)git archive --format=tar.gz --prefix=$(DIST_FILE)/ -o $(DIST_FILE).tar.gz $(GIT_TAG)

# dummy clean target
clean:

# dummy distribution clean target
distclean:

# dummy test target
test: