-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (35 loc) · 984 Bytes
/
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
# A simple makefile for creating the CCSI Pulverization distribution
VERSION := $(shell git describe --tags --dirty)
PRODUCT := Pulverization
LICENSE := LICENSE.md
PKG_DIR := CCSI_$(PRODUCT)_$(VERSION)
PACKAGE := $(PKG_DIR).tgz
PAYLOAD := model \
README.md \
$(LICENSE)
# results \
# Get just the top part (not dirname) of each entry so cp -r does the right thing
PAYLOAD_TOPS := $(foreach v,$(PAYLOAD),$(shell echo $v | cut -d'/' -f1))
# And the payload with the PKG_DIR prepended
PKG_PAYLOAD := $(addprefix $(PKG_DIR)/, $(PAYLOAD))
# OS detection & changes
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
MD5BIN=md5sum
endif
ifeq ($(UNAME), Darwin)
MD5BIN=md5
endif
ifeq ($(UNAME), FreeBSD)
MD5BIN=md5
endif
.PHONY: all clean
all: $(PACKAGE)
$(PACKAGE): $(PAYLOAD)
@mkdir $(PKG_DIR)
@cp -r $(PAYLOAD_TOPS) $(PKG_DIR)
@tar -cf - $(PKG_PAYLOAD) | gzip -n > $(PACKAGE)
@$(MD5BIN) $(PACKAGE)
@rm -rf $(PKG_DIR)
clean:
@rm -rf $(PACKAGE) $(PKG_DIR) *.tgz