forked from dkfans/keeperfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tool_png2bestpal.mk
112 lines (89 loc) · 3.36 KB
/
tool_png2bestpal.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#******************************************************************************
# Free implementation of Bullfrog's Dungeon Keeper strategy game.
#******************************************************************************
# @file tool_png2bestpal.mk
# A script used by GNU Make to recompile the project.
# @par Purpose:
# Defines make rules for tools needed to build KeeperFX.
# Most tools can either by compiled from source or downloaded.
# @par Comment:
# None.
# @author Tomasz Lis
# @date 25 Jan 2009 - 02 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.
#
#******************************************************************************
.PHONY: clean-png2bestpal deep-clean-png2bestpal
tools: $(PNGTOBSPAL)
clean-tools: clean-png2bestpal
deep-clean-tools: deep-clean-png2bestpal
ifneq (,$(wildcard tools/png2bestpal/src/png2bestpal.cpp))
# If we have source code of this tool, compile it
$(PNGTOBSPAL): tools/png2bestpal/src/png2bestpal.cpp
$(MAKE) -C tools/png2bestpal
clean-png2bestpal:
$(MAKE) -C tools/png2bestpal clean
else ifneq (,$(findstring .tar.gz,$(PNGTOBSPAL_PACKAGE)))
# If we have tar gzip prebuild, download and extract it
$(PNGTOBSPAL): tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) "$(@D)"
cd "$(@D)"; \
tar -zxmUf "../../../$<" --exclude="*color_tbl_*.txt"
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
tools/png2bestpal/res/%.txt: tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
-$(ECHO) 'Extracting encoding table: $@'
$(MKDIR) "$(@D)"
cd "$(@D)"; \
tar -zxmUf "../../../$<" --wildcards "*color_tbl_*.txt"
-$(ECHO) 'Finished extracting: $@'
-$(ECHO) ' '
tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(PNGTOBSPAL_DOWNLOAD)"
tar -tzf "[email protected]" >/dev/null
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
clean-png2bestpal:
-$(RM) tools/png2bestpal/bin/*
deep-clean-png2bestpal:
-$(RM) tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
else ifneq (,$(findstring .zip,$(PNGTOBSPAL_PACKAGE)))
# If we have zip prebuild, download and extract it
$(PNGTOBSPAL): tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
-$(ECHO) 'Extracting package: $<'
$(MKDIR) "$(@D)"
cd "$(@D)"; \
unzip -DD -qo "../../../$<" -x "color_tbl_*.txt"
-$(ECHO) 'Finished extracting: $<'
-$(ECHO) ' '
tools/png2bestpal/res/%.txt: tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
-$(ECHO) 'Extracting encoding table: $@'
$(MKDIR) "$(@D)"
cd "$(@D)"; \
unzip -DD -qo "../../../$<" "color_tbl_*.txt"
-$(ECHO) 'Finished extracting: $@'
-$(ECHO) ' '
tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE):
-$(ECHO) 'Downloading package: $@'
$(MKDIR) "$(@D)"
curl -L -o "[email protected]" "$(PNGTOBSPAL_DOWNLOAD)"
unzip -qt "[email protected]"
$(MV) "[email protected]" "$@"
-$(ECHO) 'Finished downloading: $@'
-$(ECHO) ' '
clean-png2bestpal:
-$(RM) tools/png2bestpal/bin/*
deep-clean-png2bestpal:
-$(RM) tools/png2bestpal/pkg/$(PNGTOBSPAL_PACKAGE)
else
$(error Cannot find png2bestpal tool source nor prebuild. Get package or source manually.)
endif
#******************************************************************************