-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (50 loc) · 1.27 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
# A simple makefile for creating the oxyfuel (ASU optimization) distribution zip file
VERSION=$(shell git describe --tags --dirty)
PRODUCT=ASU Optimization (oxyfuel)
PROD_SNAME=Oxyfuel
LICENSE=LICENSE.md
PKG_DIR=CCSI_$(PROD_SNAME)_$(VERSION)
PACKAGE=$(PKG_DIR).zip
PAYLOAD=docs/*.pdf \
ASUSpecFiles \
DegeneracyExamples \
InitFiles \
ModelFiles \
ProcsFiles \
ResultInputs \
ThrottleValveExampleSpecFiles \
worker0 \
*.gms \
*.m \
README.md \
$(LICENSE)
# 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 test clean
all: $(PACKAGE)
# Make zip file without extra file attribs (-X) so md5sum doesn't
# change if the payload hasn't
$(PACKAGE): $(PAYLOAD)
@mkdir $(PKG_DIR)
@cp -r $(PAYLOAD_TOPS) $(PKG_DIR)
@zip -rqX $(PACKAGE) $(PKG_PAYLOAD)
@$(MD5BIN) $(PACKAGE)
@rm -rf $(PKG_DIR)
test:
@$(MAKE) -sC test test
clean:
@$(MAKE) -sC test clean
@rm -rf $(PACKAGE) $(PKG_DIR) *.zip *~