summaryrefslogtreecommitdiff
path: root/Makefile
blob: 070cd9adbbc7b5e684902487d9549591526716ae (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
#!/bin/make
#
# Makefile for NetSurf buildsystem
#
# Copyright 2009-1013 John-Mark Bell <jmb@netsurf-browser.org>

# Component settings
COMPONENT := buildsystem
COMPONENT_VERSION := 1.0

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

install:
	mkdir -p $(BASE)/makefiles $(BASE)/testtools
	for M in $(MAKEFILES); do \
		cp makefiles/$$M $(BASE)/makefiles/; \
	done
	for T in $(TESTTOOLS); do \
		cp testtools/$$T $(BASE)/testtools/; \
	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 "v*"))
	$(eval GIT_VER := $(shell x="$(GIT_TAG)"; echo "$${x#v}"))
	$(if $(subst $(GIT_VER),,$(COMPONENT_VERSION)), $(error Component Version "$(COMPONENT_VERSION)" and GIT tag version "$(GIT_VER)" do not match))
	$(eval DIST_FILE := lib$(COMPONENT)-${GIT_VER})
	$(Q)git archive --format=tar.gz --prefix=$(DIST_FILE)/ -o $(DIST_FILE).tar.gz $(GIT_TAG)