forked from XSCE/xsce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (72 loc) · 2.66 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
77
78
79
80
81
82
83
84
85
86
87
88
# Installs OLPC XS/XSX default configurations.
# install root
DESTDIR = /
PLUGINS_ROOT := $(CURDIR)/plugins.d/
MYENV = 'DESTDIR=$(DESTDIR)'
PLUGINDIRLIST := $(shell find $(PLUGINS_ROOT) -maxdepth 1 -type d -print )
$(warning PLUGINDIRLIST IS $(PLUGINDIRLIST))
$(DESTDIR):
mkdir -p $(DESTDIR)
# For developers:
# rpm target directory
BUILDDIR = $(PWD)/build
# symbols
PKGNAME = xs-config
VERSION = $(shell git describe | sed 's/^v//' | sed 's/-/./g')
RELEASE = 1
ARCH = noarch
BRANCH = $(shell git branch | grep '*' | sed 's/* //')
# NOTE: Release is hardcoded in the spec file to 1
NV = $(PKGNAME)-$(VERSION)
REL = 1
RPMBUILD = rpmbuild \
--define "_topdir $(BUILDDIR)" \
SOURCES: Makefile
mkdir -p $(BUILDDIR)/BUILD $(BUILDDIR)/RPMS \
$(BUILDDIR)/SOURCES $(BUILDDIR)/SPECS $(BUILDDIR)/SRPMS
mkdir -p $(NV)
git archive --format=tar --prefix="$(NV)/" HEAD > $(NV).tar
mkdir -p $(NV)
echo $(VERSION) > $(NV)/build-version
tar -rf $(NV).tar $(NV)/build-version
rm -fr $(NV)
gzip $(NV).tar
mv $(NV).tar.gz $(BUILDDIR)/SOURCES/
xs-config.spec: xs-config.spec.in
sed -e 's:@VERSION@:$(VERSION):g' < $< > $@
.PHONY: xs-config.spec.in
# This forces a rebuild of xs-config.spec.in
rpm: SOURCES xs-config.spec
$(RPMBUILD) -ba --target $(ARCH) $(PKGNAME).spec
rm -fr $(BUILDDIR)/BUILD/$(NV)
#rpmlint $(BUILDDIR)/RPMS/$(ARCH)/$(NV)-$(REL).$(ARCH).rpm
# for scp `make rpm-name` ...
rpm-name:
@echo $(BUILDDIR)/RPMS/$(ARCH)/$(NV)-$(REL).$(ARCH).rpm
publish:
scp $(BUILDDIR)/RPMS/$(ARCH)/$(NV)-$(REL).$(ARCH).rpm \
xs-dev.laptop.org:/xsrepos/testing/olpc/11/i586/
scp $(BUILDDIR)/SRPMS/$(NV)-$(REL).src.rpm \
xs-dev.laptop.org:/xsrepos/testing/olpc/11/source/SRPMS/
ssh xs-dev.laptop.org sudo createrepo /xsrepos/testing/olpc/11/i586
ssh xs-dev.laptop.org sudo createrepo /xsrepos/testing/olpc/11/source/SRPMS
publish-stable:
scp $(BUILDDIR)/RPMS/$(ARCH)/$(NV)-$(REL).$(ARCH).rpm \
xs-dev.laptop.org:/xsrepos/testing/olpc/$(BRANCH)/i586/
scp $(BUILDDIR)/SRPMS/$(NV)-$(REL).src.rpm \
xs-dev.laptop.org:/xsrepos/testing/olpc/$(BRANCH)/source/SRPMS/
ssh xs-dev.laptop.org sudo createrepo /xsrepos/testing/olpc/$(BRANCH)/i586
ssh xs-dev.laptop.org sudo createrepo /xsrepos/testing/olpc/$(BRANCH)/source/SRPMS
MY = one two
install:
# Makefile at PLUGINS_ROOT creates all the directories in BUILDROOT
(cd $(PLUGINS_ROOT); $(MAKE) $(MFLAGS) $(MYENV) install)
@for D in $(PLUGINDIRLIST); do \
(cd $$D; echo $$D; $(MAKE) $(MFLAGS) $(MYENV) install) \
done
# use print-<macro> from command line to inspect its value
print-%: ; @echo $* is $($*)
# cause shell commands to output the rules being executed
#OLD_SHELL := $(SHELL)
#SHELL = $(warning [$@ ($^)
# ($?)]) $(OLD SHELL)