File: Makefile.bundle

package info (click to toggle)
grfcodec 6.0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,124 kB
  • sloc: cpp: 12,624; ansic: 748; makefile: 196; perl: 132; sh: 77
file content (130 lines) | stat: -rw-r--r-- 5,006 bytes parent folder | download | duplicates (5)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#
# Creation of bundles
#

# Standard make convention variables/locations
prefix         ?= /usr/local
exec_prefix    ?= $(prefix)
datarootdir    ?= $(prefix)/share
datadir        ?= $(datarootdir)

bindir         ?= $(exec_prefix)/bin
mandir         ?= $(datarootdir)/man
man1dir        ?= $(mandir)/man1
docdir         ?= $(datarootdir)/doc/$(PACKAGE_NAME)

openttddir     ?= $(datarootdir}/openttd
openttdgmdir   ?= $(openttddir)/gm/$(PACKAGE_NAME)
openttddatadir ?= $(openttddir)/data/$(PACKAGE_NAME)

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

ifndef BUNDLE_NAME
BUNDLE_NAME = $(PACKAGE_NAME)-$(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)/docs"
	$(_C)mkdir -p "$(BUNDLE_DIR)/man"
	$(_C)cp $(GRFCODEC)        "$(BUNDLE_DIR)/"
	$(_C)cp $(GRFID)           "$(BUNDLE_DIR)/"
	$(_C)cp $(GRFSTRIP)        "$(BUNDLE_DIR)/"
	$(_C)cp $(NFORENUM)        "$(BUNDLE_DIR)/"
	$(_C)cp COPYING            "$(BUNDLE_DIR)/COPYING"
	$(_C)cp changelog.txt      "$(BUNDLE_DIR)/"
	$(_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" "$(BUNDLE_DIR)/changelog.txt"
endif

install: bundle
	@echo '[INSTALL] Installing'
	$(_C)install -d "$(DESTDIR)$(bindir)"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFCODEC)" "$(DESTDIR)$(bindir)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFID)" "$(DESTDIR)$(bindir)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(GRFSTRIP)" "$(DESTDIR)$(bindir)/"
	$(_C)install -m 755 "$(BUNDLE_DIR)/$(NFORENUM)" "$(DESTDIR)$(bindir)/"
ifndef DO_NOT_INSTALL_DOCS
	$(_C)install -d "$(DESTDIR)$(docdir)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(DESTDIR)$(docdir)"
endif
ifndef DO_NOT_INSTALL_CHANGELOG
	$(_C)install -d "$(DESTDIR)$(docdir)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/changelog.txt" "$(DESTDIR)$(docdir)"
endif
ifndef DO_NOT_INSTALL_LICENSE
	$(_C)install -d "$(DESTDIR)$(docdir)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/COPYING" "$(DESTDIR)$(docdir)"
endif
ifndef DO_NOT_INSTALL_MAN
	$(_C)install -d "$(DESTDIR)$(man1dir)"
	$(_C)install -m 644 "$(BUNDLE_DIR)/man/"*.1.gz "$(DESTDIR)$(man1dir)/"
endif

### 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)/GRF Development Tools $(REV)"
	$(_C)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/GRF Development Tools $(REV)"
	$(_C)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/GRF Development Tools $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg"
	$(_C)rm -fr "$(BUNDLES_DIR)/GRF Development Tools $(REV)"

bundle_src:
	$(_E) '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz'
	$(_C) hg archive -t tar $(BUNDLE_NAME).tar -X "\.hg*" -X "\.devzone*" -X "version.def"
	$(_C) mkdir -p $(BUNDLE_NAME)
	$(_C) echo YEAR = "$(YEAR)" >> $(BUNDLE_NAME)/version.def
	$(_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