forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (61 loc) · 2.25 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
# Copyright (c) 2014 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
TARGET = crouton
EXTTARGET = crouton.zip
SRCTARGETS = $(patsubst src/%.c,crouton%,$(wildcard src/*.c))
CONTRIBUTORS = CONTRIBUTORS
WRAPPER = build/wrapper.sh
SCRIPTS := \
$(wildcard chroot-bin/*) \
$(wildcard chroot-etc/*) \
$(wildcard host-bin/*) \
$(wildcard installer/*.sh) installer/functions \
$(wildcard installer/*/*) \
$(wildcard src/*) \
$(wildcard targets/*)
EXTSOURCES = $(wildcard host-ext/crouton/*)
GENVERSION = build/genversion.sh
CONTRIBUTORSSED = build/CONTRIBUTORS.sed
RELEASE = build/release.sh
VERSION = 1
TARPARAMS ?= -j
croutoncursor_LIBS = -lX11 -lXfixes -lXrender
croutonwmtools_LIBS = -lX11
croutonxi2event_LIBS = -lX11 -lXi
ifeq ($(wildcard .git/HEAD),)
GITHEAD :=
else
GITHEADFILE := .git/refs/heads/$(shell cut -d/ -f3 '.git/HEAD')
ifeq ($(wildcard $(GITHEADFILE)),)
GITHEAD := .git/HEAD
else
GITHEAD := .git/HEAD .git/refs/heads/$(shell cut -d/ -f3 '.git/HEAD')
endif
endif
$(TARGET): $(WRAPPER) $(SCRIPTS) $(GENVERSION) $(GITHEAD) Makefile
{ \
sed -e "s/\$$TARPARAMS/$(TARPARAMS)/" \
-e "s/VERSION=.*/VERSION='$(shell $(GENVERSION) $(VERSION))'/" \
$(WRAPPER) \
&& tar --owner=root --group=root -c $(TARPARAMS) $(SCRIPTS) \
&& chmod +x /dev/stdout \
;} > $(TARGET) || ! rm -f $(TARGET)
$(EXTTARGET): $(EXTSOURCES) Makefile
rm -f $(EXTTARGET) && zip -q --junk-paths $(EXTTARGET) $(EXTSOURCES)
$(SRCTARGETS): src/$(patsubst crouton%,src/%.c,$@) Makefile
gcc -g -Wall -Werror $(patsubst crouton%,src/%.c,$@) $($@_LIBS) -o $@
extension: $(EXTTARGET)
$(CONTRIBUTORS): $(GITHEAD) $(CONTRIBUTORSSED)
git shortlog -s | sed -f $(CONTRIBUTORSSED) | sort -u > $(CONTRIBUTORS)
contributors: $(CONTRIBUTORS)
release: $(CONTRIBUTORS) $(TARGET) $(RELEASE)
[ ! -d .git ] || git status | grep -q 'working directory clean' || \
{ echo "There are uncommitted changes. Aborting!" 1>&2; exit 2; }
$(RELEASE) $(TARGET)
force-release: $(CONTRIBUTORS) $(TARGET) $(RELEASE)
$(RELEASE) -f $(TARGET)
all: $(TARGET) $(SRCTARGETS) $(EXTTARGET)
clean:
rm -f $(TARGET) $(EXTTARGET) $(SRCTARGETS)
.PHONY: all clean contributors extension release force-release