File: Makefile.bundle

package info (click to toggle)
grfcodec 1.0.0%2Bdebian1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 548 kB
  • ctags: 782
  • sloc: cpp: 5,502; makefile: 187; sh: 74; perl: 50; asm: 19
file content (104 lines) | stat: -rw-r--r-- 4,121 bytes parent folder | download
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# Creation of bundles
#

ifeq (${V},1)
VERBOSE := 1
endif

ifndef BUNDLE_NAME
BUNDLE_NAME = grfcodec-$(REV)
endif

ROOT_DIR = $(shell pwd)

ifndef BUNDLE_DIR
BUNDLE_DIR := "$(ROOT_DIR)/bundle"
endif

ifndef BUNDLES_DIR
BUNDLES_DIR := "$(ROOT_DIR)/bundles"
endif

bundle: release
	$(_E) '[BUNDLE] Constructing bundle'
	$(_C)rm -rf   "$(BUNDLE_DIR)"
	$(_C)mkdir -p "$(BUNDLE_DIR)"
	$(_C)mkdir -p "$(BUNDLE_DIR)"
	$(_C)mkdir -p "$(BUNDLE_DIR)/docs"
	$(_C)mkdir -p "$(BUNDLE_DIR)/man"
	$(_C)cp $(GRFCODEC)        "$(BUNDLE_DIR)/"
	$(_C)cp $(GRFDIFF)         "$(BUNDLE_DIR)/"
	$(_C)cp $(GRFMERGE)        "$(BUNDLE_DIR)/"
	$(_C)cp $(GRFID)           "$(BUNDLE_DIR)/"
	$(_C)cp COPYING            "$(BUNDLE_DIR)/COPYING"
	$(_C)cp changelog.txt      "$(BUNDLE_DIR)/docs/"
	$(_C)cp docs/*.txt         "$(BUNDLE_DIR)/docs/"
	$(_C)cp docs/*.1           "$(BUNDLE_DIR)/man/"
	$(_C)gzip -9               "$(BUNDLE_DIR)/man/"*.1
ifeq ($(GRFCODEC), grfcodec.exe)
	$(_C)unix2dos "$(BUNDLE_DIR)/docs/"*.txt "$(BUNDLE_DIR)/COPYING"
endif

install: bundle
	@echo '[INSTALL] Installing NFORenum'
	$(_C)install -d "$(INSTALL_DOCS_DIR)"
	$(_C)install -d "$(INSTALL_BINARY_DIR)"
	$(_C)install -d "$(INSTALL_MAN_DIR)"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFCODEC)" "$(INSTALL_BINARY_DIR)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFMERGE)" "$(INSTALL_BINARY_DIR)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFDIFF)" "$(INSTALL_BINARY_DIR)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFID)" "$(INSTALL_BINARY_DIR)/"
	$(_C)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DOCS_DIR)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/COPYING" "$(INSTALL_DOCS_DIR)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/man/"*.1.gz "$(INSTALL_MAN_DIR)/"

### Packing the current bundle into several compressed file formats ###
#
# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg.
# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle.
#
# One can supply a custom name by adding BUNDLE_NAME:=<name> to the make command.
#
bundle_zip: bundle
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).zip'
	$(_C)mkdir -p "$(BUNDLES_DIR)"
	$(_C)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" .

bundle_gzip: bundle
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz'
	$(_C)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)"
	$(_C)cp -R    "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/"
	$(_C)cd "$(BUNDLES_DIR)/.gzip" && tar -zc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.gz" "$(BUNDLE_NAME)"
	$(_C)rm -rf   "$(BUNDLES_DIR)/.gzip"

bundle_bzip2: bundle
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2'
	$(_C)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)"
	$(_C)cp -R    "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/"
	$(_C)cd "$(BUNDLES_DIR)/.bzip2" && tar -jc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.bz2" "$(BUNDLE_NAME)"
	$(_C)rm -rf   "$(BUNDLES_DIR)/.bzip2"

bundle_lha: bundle
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).lha'
	$(_C)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)"
	$(_C)cp -R    "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/"
	$(_C)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)"
	$(_C)rm -rf   "$(BUNDLES_DIR)/.lha"

bundle_dmg: bundle
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).dmg'
	$(_C)mkdir -p "$(BUNDLES_DIR)/GRFCodec $(REV)"
	$(_C)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/GRFCodec $(REV)"
	$(_C)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/GRFCodec $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg"
	$(_C)rm -fr "$(BUNDLES_DIR)/GRFCodec $(REV)"

bundle_src:
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz'
	$(_C) hg archive -t tar $(BUNDLE_NAME).tar -X "\.hg*" -X "\.devzone*"
	$(_C) mkdir -p $(BUNDLE_NAME)
	$(_C) echo REV = "$(REV)" >> $(BUNDLE_NAME)/version.def
	$(_C) echo VERSIONSTR = "$(VERSIONSTR)" >> $(BUNDLE_NAME)/version.def
	$(_C) tar -uf $(BUNDLE_NAME).tar $(BUNDLE_NAME)/version.def
	$(_C) rm -rf $(BUNDLE_NAME)
	$(_C) $(SRCZIP) $(SRCZIP_FLAGS) $(BUNDLE_NAME).tar