|
| 1 | +# A simple makefile for creating the High Resolution CFD Models bundled product |
| 2 | +VERSION := 2015.10.00 |
| 3 | +PRODUCT := Process Models Bundle |
| 4 | +PROD_SNAME := ProcessModels_bundle |
| 5 | +LICENSE := CCSI_TE_LICENSE_$(PROD_SNAME).txt |
| 6 | +PKG_DIR := CCSI_$(PROD_SNAME)_$(VERSION) |
| 7 | +PACKAGE := $(PKG_DIR).zip |
| 8 | + |
| 9 | +CATEGORIES := SolidSorbents Solvents OtherModels |
| 10 | + |
| 11 | +# Where Jenkins should checkout ^/projects/common/trunk/ |
| 12 | +COMMON := .ccsi_common |
| 13 | +LEGAL_DOCS := LEGAL \ |
| 14 | + CCSI_TE_LICENSE.txt |
| 15 | + |
| 16 | +TARBALLS := *.tgz |
| 17 | +ZIPFILES := *.zip |
| 18 | + |
| 19 | +# The bundled packages, as found in each category subdir |
| 20 | +SUB_PACKAGES := $(foreach c,$(CATEGORIES), $(wildcard $c/$(TARBALLS) $c/$(ZIPFILES))) |
| 21 | + |
| 22 | +PAYLOAD := docs/*.pdf \ |
| 23 | + LEGAL \ |
| 24 | + $(LICENSE) |
| 25 | + |
| 26 | +# Get just the top part (not dirname) of each entry so cp -r does the right thing |
| 27 | +PAYLOAD_TOPS := $(foreach v,$(PAYLOAD),$(shell echo $v | cut -d'/' -f1)) |
| 28 | +# And the payload (including expanded projects) with the PKG_DIR prepended |
| 29 | +PKG_PAYLOAD := $(addprefix $(PKG_DIR)/, $(PAYLOAD) $(basename $(SUB_PACKAGES))) |
| 30 | + |
| 31 | +# OS detection & changes |
| 32 | +UNAME := $(shell uname) |
| 33 | +ifeq ($(UNAME), Linux) |
| 34 | + MD5BIN=md5sum |
| 35 | +endif |
| 36 | +ifeq ($(UNAME), Darwin) |
| 37 | + MD5BIN=md5 |
| 38 | +endif |
| 39 | +ifeq ($(UNAME), FreeBSD) |
| 40 | + MD5BIN=md5 |
| 41 | +endif |
| 42 | + |
| 43 | +.PHONY: all clean $(CATEGORIES) |
| 44 | + |
| 45 | +all: $(PACKAGE) |
| 46 | + |
| 47 | +# Go into each category's subdir and break open the archives there |
| 48 | +# into the corresponding subdir in the PKG_DIR |
| 49 | +$(CATEGORIES): |
| 50 | + @mkdir -p $(PKG_DIR)/$@ |
| 51 | + |
| 52 | + @for tb in $(wildcard $@/$(TARBALLS)); do \ |
| 53 | + tar -xzf $$tb -C $(PKG_DIR)/$@; \ |
| 54 | + done |
| 55 | + |
| 56 | + @for zf in $(wildcard $@/$(ZIPFILES)); do \ |
| 57 | + unzip -qo $$zf -d $(PKG_DIR)/$@; \ |
| 58 | + done |
| 59 | + |
| 60 | +$(PACKAGE): $(PAYLOAD) $(CATEGORIES) |
| 61 | + @mkdir -p $(PKG_DIR) |
| 62 | + @cp -r $(PAYLOAD_TOPS) $(PKG_DIR) |
| 63 | + @zip -qXr $(PACKAGE) $(PKG_PAYLOAD) |
| 64 | + @$(MD5BIN) $(PACKAGE) |
| 65 | + @rm -rf $(PKG_DIR) $(LEGAL_DOCS) $(LICENSE) |
| 66 | + |
| 67 | +$(LICENSE): CCSI_TE_LICENSE.txt |
| 68 | + @sed "s/\[SOFTWARE NAME \& VERSION\]/$(PRODUCT) v.$(VERSION)/" < CCSI_TE_LICENSE.txt > $(LICENSE) |
| 69 | + |
| 70 | +$(LEGAL_DOCS): |
| 71 | + @if [ -d $(COMMON) ]; then \ |
| 72 | + cp $(COMMON)/$@ .; \ |
| 73 | + else \ |
| 74 | + svn -q export ^/projects/common/trunk/$@; \ |
| 75 | + fi |
| 76 | + |
| 77 | +clean: |
| 78 | + @rm -rf $(PACKAGE) $(PKG_DIR) $(LEGAL_DOCS) $(LICENSE) |
0 commit comments