forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (49 loc) · 1.7 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
# Copyright (c) 2013 The Chromium OS 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))
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
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)
all: $(TARGET) $(SRCTARGETS) $(EXTTARGET)
clean:
rm -f $(TARGET) $(EXTTARGET) $(SRCTARGETS)
.PHONY: all clean extension