forked from opensciencegrid/osg-ca-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (53 loc) · 2.54 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
# Makefile for osg-ca-scripts
# ------------------------------------------------------------------------------
# Release information: Update for each release
# ------------------------------------------------------------------------------
PACKAGE := osg-ca-scripts
VERSION := 1.1.7
# ------------------------------------------------------------------------------
# Other configuration: May need to change for a release
# ------------------------------------------------------------------------------
DIST_FILES := bin cron.d etc init.d lib libexec logrotate sbin
# ------------------------------------------------------------------------------
# Internal variables: Do not change for a release
# ------------------------------------------------------------------------------
DIST_DIR_PREFIX := dist_dir_
TARBALL_DIR := $(PACKAGE)-$(VERSION)
TARBALL_NAME := $(PACKAGE)-$(VERSION).tar.gz
UPSTREAM := /p/vdt/public/html/upstream
UPSTREAM_DIR := $(UPSTREAM)/$(PACKAGE)/$(VERSION)
# ------------------------------------------------------------------------------
.PHONY: _default distclean clean dist
_default:
@echo "There is no default target; choose one of the following:"
@echo "make dist -- make a distribution source tarball"
@echo "make upstream [UPSTREAM=path] -- install source tarball to upstream cache rooted at path"
distclean:
rm -f *.tar.gz
ifneq ($(strip $(DIST_DIR_PREFIX)),) # avoid evil
rm -fr $(DIST_DIR_PREFIX)*
endif
clean:
rm -fr osg-ca-scripts-*
$(TARBALL_NAME): $(DIST_FILES)
$(eval TEMP_DIR := $(shell mktemp -d -p . $(DIST_DIR_PREFIX)XXXXXXXXXX))
mkdir -p $(TEMP_DIR)/$(TARBALL_DIR)
cp -pr $(DIST_FILES) $(TEMP_DIR)/$(TARBALL_DIR)/
find $(TEMP_DIR)/$(TARBALL_DIR) -name '*~' -print0 | xargs --null rm -f
find $(TEMP_DIR)/$(TARBALL_DIR) -name '.#*' -print0 | xargs --null rm -f
find $(TEMP_DIR)/$(TARBALL_DIR) -name .svn -type d -print0 | xargs --null rm -fr
sed -i -e 's/##VERSION##/$(VERSION)/g' $(TEMP_DIR)/$(TARBALL_DIR)/sbin/osg-ca-manage
tar czf $(TARBALL_NAME) -C $(TEMP_DIR) $(TARBALL_DIR)
rm -rf $(TEMP_DIR)
dist: $(TARBALL_NAME)
upstream: $(TARBALL_NAME)
ifeq ($(shell ls -1d $(UPSTREAM) 2>/dev/null),)
@echo "Must have existing upstream cache directory at '$(UPSTREAM)'"
else ifneq ($(shell ls -1 $(UPSTREAM_DIR)/$(TARBALL_NAME) 2>/dev/null),)
@echo "Source tarball already installed at '$(UPSTREAM_DIR)/$(TARBALL_NAME)'"
@echo "Remove installed source tarball or increment release version"
else
mkdir -p $(UPSTREAM_DIR)
install -p -m 0644 $(TARBALL_NAME) $(UPSTREAM_DIR)/$(TARBALL_NAME)
rm -f $(TARBALL_NAME)
endif