-
Notifications
You must be signed in to change notification settings - Fork 10
/
package.mk
95 lines (83 loc) · 3.63 KB
/
package.mk
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
#******************************************************************************
# Free implementation of Bullfrog's Dungeon Keeper strategy game.
#******************************************************************************
# @file package.mk
# A script used by GNU Make to recompile the project.
# @par Purpose:
# Defines make rules for package with release of KeeperFX.
# @par Comment:
# None.
# @author Tomasz Lis
# @date 01 Jul 2011 - 01 Jul 2011
# @par Copying and copyrights:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#******************************************************************************
CAMPAIGN_CFGS = $(patsubst %,pkg/campgns/%.cfg,$(CAMPAIGNS))
.PHONY: pkg-before pkg-copydat pkg-campaigns pkg-languages
package: pkg/keeperfx-$(subst .,_,$(VER_STRING))-$(PACKAGE_SUFFIX)-patch.7z
clean-package:
-$(RM) -R pkg/campgns
-$(RM) -R pkg/creatrs
-$(RM) -R pkg/fxdata
-$(RM) -R pkg/ldata
-$(RM) -R pkg/data
-$(RM) -R pkg/sound
-$(RM) -R pkg/levels
-$(RM) pkg/keeperfx*
deep-clean-package:
pkg/%.7z: pkg-before pkg-copybin pkg-copydat pkg-campaigns pkg-languages
$(ECHO) 'Creating package: $@'
cd $(@D); \
7z a "$(@F)" "*" -x!*/.svn -x!.svn -x!.git -x!*.7z
$(ECHO) 'Finished creating: $@'
$(ECHO) ' '
pkg-before:
-$(RM) "pkg/keeperfx-$(subst .,_,$(VER_STRING))-*-patch.7z"
$(MKDIR) pkg/creatrs
$(MKDIR) pkg/data
$(MKDIR) pkg/ldata
$(MKDIR) pkg/fxdata
$(MKDIR) pkg/campgns
pkg-copybin: pkg-before
$(CP) bin/* pkg/
$(CP) docs/keeperfx_readme.txt pkg/
pkg-copydat: pkg-before
$(CP) config/keeperfx.cfg pkg/
$(CP) config/creatrs/*.cfg pkg/creatrs/
$(CP) config/fxdata/*.cfg pkg/fxdata/
pkg-campaigns: pkg-before $(CAMPAIGN_CFGS)
# special block for Original Campaign - it is copied elswhere
pkg/campgns/keeporig.cfg: campgns/keeporig.cfg
@$(MKDIR) $(@D)
# Copy folder with campaign name (w/o extension), if it exists
$(if $(wildcard $(<:%.cfg=%)),$(MKDIR) pkg/levels)
$(if $(wildcard $(<:%.cfg=%)),-$(CP) $(<:%.cfg=%)/map*.* pkg/levels/)
# Copy folder with campaign name and _cfgs ending, if it exists
$(if $(wildcard $(<:%.cfg=%_cfgs)),$(MKDIR) $(@:%.cfg=%_cfgs))
$(if $(wildcard $(<:%.cfg=%_cfgs)),-$(CP) $(<:%.cfg=%_cfgs)/*.cfg $(@:%.cfg=%_cfgs)/)
# Copy folder with campaign name and _crtr ending, if it exists
$(if $(wildcard $(<:%.cfg=%_crtr)),$(MKDIR) $(@:%.cfg=%_crtr))
$(if $(wildcard $(<:%.cfg=%_crtr)),-$(CP) $(<:%.cfg=%_crtr)/*.cfg $(@:%.cfg=%_crtr)/)
# Copy folder with campaign name and _lnd ending, if it exists
$(if $(wildcard $(<:%.cfg=%_lnd)),$(MKDIR) pkg/ldata)
$(if $(wildcard $(<:%.cfg=%_lnd)),-$(CP) $(<:%.cfg=%_lnd)/*.txt pkg/ldata/)
# Copy the actual campaign file
$(CP) $< $@
pkg/campgns/%.cfg: campgns/%.cfg
@$(MKDIR) $(@D)
# Copy folder with campaign name (w/o extension), if it exists
$(if $(wildcard $(<:%.cfg=%)),$(MKDIR) $(@:%.cfg=%))
$(if $(wildcard $(<:%.cfg=%)),-$(CP) $(<:%.cfg=%)/map*.* $(@:%.cfg=%)/)
# Copy folder with campaign name and _crtr ending, if it exists
$(if $(wildcard $(<:%.cfg=%_crtr)),$(MKDIR) $(@:%.cfg=%_crtr))
$(if $(wildcard $(<:%.cfg=%_crtr)),-$(CP) $(<:%.cfg=%_crtr)/*.cfg $(@:%.cfg=%_crtr)/)
# Copy folder with campaign name and _lnd ending, if it exists
$(if $(wildcard $(<:%.cfg=%_lnd)),$(MKDIR) $(@:%.cfg=%_lnd))
$(if $(wildcard $(<:%.cfg=%_lnd)),-$(CP) $(<:%.cfg=%_lnd)/*.txt $(@:%.cfg=%_lnd)/)
# Copy the actual campaign file
$(CP) $< $@
#******************************************************************************