forked from opensciencegrid/osg-system-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (59 loc) · 2.68 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
# Makefile for osg-system-profiler
# ------------------------------------------------------------------------------
# Release information: Update for each release
# ------------------------------------------------------------------------------
PACKAGE := osg-system-profiler
VERSION := 1.6.0
# ------------------------------------------------------------------------------
# Other configuration: May need to change for a release
# ------------------------------------------------------------------------------
BIN_DIR := usr/bin
BIN_FILES := osg-system-profiler osg-system-profiler-viewer \
osg-installed-versions
LIBEXEC_DIR := usr/libexec/$(PACKAGE)
LIBEXEC_FILES := gratia-pbs-lsf-config-check
DIST_FILES := $(BIN_FILES) $(LIBEXEC_FILES) Makefile
# ------------------------------------------------------------------------------
# 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 install dist upstream
_default:
@echo "There is no default target; choose one of the following:"
@echo "make install [DESTDIR=path] -- install files to path"
@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
install:
mkdir -p $(DESTDIR)/$(BIN_DIR)
install -p -m 0755 $(BIN_FILES) $(DESTDIR)/$(BIN_DIR)
mkdir -p $(DESTDIR)/$(LIBEXEC_DIR)
install -p -m 0755 $(LIBEXEC_FILES) $(DESTDIR)/$(LIBEXEC_DIR)
dist: $(TARBALL_NAME)
$(TARBALL_NAME): $(DIST_FILES)
$(eval TEMP_DIR := $(shell mktemp -d -p . $(DIST_DIR_PREFIX)XXXXXXXXXX))
mkdir -p $(TEMP_DIR)/$(TARBALL_DIR)
cp -p $(DIST_FILES) $(TEMP_DIR)/$(TARBALL_DIR)/
tar czf $(TARBALL_NAME) -C $(TEMP_DIR) $(TARBALL_DIR)
rm -rf $(TEMP_DIR)
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)
@echo "SHA1SUM:"
sha1sum $(TARBALL_NAME)
endif