-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (46 loc) · 1.51 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
export BR=$(CURDIR)/build-root
$(BR)/scripts/.version:
ifneq ("$(wildcard /etc/redhat-release)","")
$(shell $(BR)/scripts/version rpm-string > $(BR)/scripts/.version)
else
$(shell $(BR)/scripts/version > $(BR)/scripts/.version)
endif
DIST_FILE = $(BR)/uio_hv_generic-$(shell extras/scripts/version).tar
DIST_SUBDIR = uio_hv_generic-$(shell extras/scripts/version | cut -f1 -d-)
dist:
@if git rev-parse 2> /dev/null ; then \
git archive \
--prefix=$(DIST_SUBDIR)/ \
--format=tar \
-o $(DIST_FILE) \
HEAD ; \
git describe > $(BR)/.version ; \
else \
(cd .. ; tar -cf $(DIST_FILE) $(DIST_SUBDIR) --exclude=*.tar) ; \
extras/scripts/version > $(BR)/.version ; \
fi
@tar --append \
--file $(DIST_FILE) \
--transform='s,.*/.version,$(DIST_SUBDIR)/extras/scripts/.version,' \
$(BR)/.version
@for f in $$(git status --porcelain | grep '^D' | awk '{print $$2}'); do \
tar --delete --file $(DIST_FILE) $(DIST_SUBDIR)/$${f}; \
done
@for f in $$(git status --porcelain -u | grep -v '^D' | awk '{print $$2}'); do \
tar --append --file $(DIST_FILE) \
--transform="s,$${f},$(DIST_SUBDIR)/$${f}," \
$${f}; \
done
@$(RM) $(BR)/.version $(DIST_FILE).xz
@$(RM) $(BR)/.version $(DIST_FILE).xz
@xz -v --threads=0 $(DIST_FILE)
@$(RM) $(BR)/uio_hv_generic-latest.tar.xz
@ln -rs $(DIST_FILE).xz $(BR)/uio_hv_generic-latest.tar.xz
pkg-rpm: dist
make -C extras/rpm
pkg-srpm: dist
make -C extras/rpm srpm
clean:
@$(RM) $(BR)/*.tar.xz
@$(RM) $(BR)/*.rpm
@$(RM) -r $(BR)/rpmbuild