-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
359 lines (288 loc) · 16.6 KB
/
Makefile
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
CLEAN_TARGETS=
CHECKS=mkdir -p xschem/gpio/results; mkdir -p temp/;
.ONESHELL:
all: xschem/gpio/results/armleo_gpio.drcrpt \
xschem/gpio/results/armleo_gpio.lvsrpt \
xschem/gpio/results/armleo_gpio.pexspice \
xschem/gpio/results/armleo_gpio_lv2hv.drcrpt \
xschem/gpio/results/armleo_gpio_lv2hv.lvsrpt \
xschem/gpio/results/armleo_gpio_lv2hv.pexspice \
xschem/gpio/results/armleo_gpio_tb.simlog \
xschem/gpio/results/armleo_gpio_worst_tb.simlog \
xschem/gpio/results/armleo_gpio_tb_caravel.simlog \
xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.simlog \
xschem/gpio/results/armleo_gpio_lv2hv_tb.simlog \
xschem/gpio/results/armleo_gpio_esd_tb.simlog \
lef/armleo_gpio.lef
CLEAN_TARGETS+=
.PRECIOUS: gpio/netlists/armleo_gpio.spice
xschem/gpio/netlists/armleo_gpio.spice: xschem/gpio/armleo_gpio.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/armleo_gpio.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio.drcrpt
xschem/gpio/results/armleo_gpio.drcrpt: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_drc.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio \
OUTPUT_RPT_FILE=../xschem/gpio/results/armleo_gpio.drcrpt \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_drc.tcl\
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio.lvsspice
xschem/gpio/results/armleo_gpio.lvsspice: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_lvs.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio \
OUTPUT_FILE=../xschem/gpio/results/armleo_gpio.lvsspice \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_lvs.tcl\
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio.lvsrpt
xschem/gpio/results/armleo_gpio.lvsrpt: xschem/gpio/results/armleo_gpio.lvsspice xschem/gpio/netlists/armleo_gpio_tb.spice uncompress Makefile
$(CHECKS)
cd temp && \
netgen -batch lvs \
"../xschem/gpio/results/armleo_gpio.lvsspice armleo_gpio" \
"../xschem/gpio/netlists/armleo_gpio_tb.spice armleo_gpio" \
${PDK_ROOT}/sky130A/libs.tech/netgen/sky130A_setup.tcl ../xschem/gpio/results/armleo_gpio.lvsrpt \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio.pexspice
xschem/gpio/results/armleo_gpio.pexspice: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_pex.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio \
OUTPUT_FILE=../xschem/gpio/results/armleo_gpio.pexspice \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_pex.tcl\
&& cd -
CLEAN_TARGETS+=
.PRECIOUS: gpio/netlists/armleo_gpio_lv2hv.spice
xschem/gpio/netlists/armleo_gpio_lv2hv.spice: xschem/gpio/armleo_gpio_lv2hv.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/armleo_gpio_lv2hv.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv.drcrpt
xschem/gpio/results/armleo_gpio_lv2hv.drcrpt: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_drc.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio_lv2hv \
OUTPUT_RPT_FILE=../xschem/gpio/results/armleo_gpio_lv2hv.drcrpt \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_drc.tcl\
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv.lvsspice
xschem/gpio/results/armleo_gpio_lv2hv.lvsspice: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_lvs.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio_lv2hv \
OUTPUT_FILE=../xschem/gpio/results/armleo_gpio_lv2hv.lvsspice \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_lvs.tcl\
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv.lvsrpt
xschem/gpio/results/armleo_gpio_lv2hv.lvsrpt: xschem/gpio/results/armleo_gpio_lv2hv.lvsspice xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice uncompress Makefile
$(CHECKS)
cd temp && \
netgen -batch lvs \
"../xschem/gpio/results/armleo_gpio_lv2hv.lvsspice armleo_gpio_lv2hv" \
"../xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice armleo_gpio_lv2hv" \
${PDK_ROOT}/sky130A/libs.tech/netgen/sky130A_setup.tcl ../xschem/gpio/results/armleo_gpio_lv2hv.lvsrpt \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv.pexspice
xschem/gpio/results/armleo_gpio_lv2hv.pexspice: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/magic_pex.tcl
$(CHECKS)
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
TOP_CELL=armleo_gpio_lv2hv \
OUTPUT_FILE=../xschem/gpio/results/armleo_gpio_lv2hv.pexspice \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/magic_pex.tcl\
&& cd -
.PRECIOUS: gpio/netlists/armleo_gpio_tb.spice
xschem/gpio/netlists/armleo_gpio_tb.spice: xschem/gpio/testbenches/armleo_gpio_tb.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_tb.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_tb.simlog
xschem/gpio/results/armleo_gpio_tb.simlog: xschem/gpio/netlists/armleo_gpio_tb.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_tb.raw" -o "../xschem/gpio/results/armleo_gpio_tb.simlog" "../xschem/gpio/netlists/armleo_gpio_tb.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_tb.pexspice
xschem/gpio/netlists/armleo_gpio_tb.pexspice: xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_tb.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_tb.spice xschem/gpio/netlists/armleo_gpio_tb.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_tb.pexsimlog
xschem/gpio/results/armleo_gpio_tb.pexsimlog: xschem/gpio/netlists/armleo_gpio_tb.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_tb.pexraw" -o "../xschem/gpio/results/armleo_gpio_tb.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_tb.pexspice"
cd -
.PRECIOUS: gpio/netlists/armleo_gpio_worst_tb.spice
xschem/gpio/netlists/armleo_gpio_worst_tb.spice: xschem/gpio/testbenches/armleo_gpio_worst_tb.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_worst_tb.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_worst_tb.simlog
xschem/gpio/results/armleo_gpio_worst_tb.simlog: xschem/gpio/netlists/armleo_gpio_worst_tb.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_worst_tb.raw" -o "../xschem/gpio/results/armleo_gpio_worst_tb.simlog" "../xschem/gpio/netlists/armleo_gpio_worst_tb.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_worst_tb.pexspice
xschem/gpio/netlists/armleo_gpio_worst_tb.pexspice: xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_worst_tb.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_worst_tb.spice xschem/gpio/netlists/armleo_gpio_worst_tb.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_worst_tb.pexsimlog
xschem/gpio/results/armleo_gpio_worst_tb.pexsimlog: xschem/gpio/netlists/armleo_gpio_worst_tb.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_worst_tb.pexraw" -o "../xschem/gpio/results/armleo_gpio_worst_tb.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_worst_tb.pexspice"
cd -
.PRECIOUS: gpio/netlists/armleo_gpio_tb_caravel.spice
xschem/gpio/netlists/armleo_gpio_tb_caravel.spice: xschem/gpio/testbenches/armleo_gpio_tb_caravel.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_tb_caravel.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_tb_caravel.simlog
xschem/gpio/results/armleo_gpio_tb_caravel.simlog: xschem/gpio/netlists/armleo_gpio_tb_caravel.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_tb_caravel.raw" -o "../xschem/gpio/results/armleo_gpio_tb_caravel.simlog" "../xschem/gpio/netlists/armleo_gpio_tb_caravel.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_tb_caravel.pexspice
xschem/gpio/netlists/armleo_gpio_tb_caravel.pexspice: xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_tb_caravel.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_tb_caravel.spice xschem/gpio/netlists/armleo_gpio_tb_caravel.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_tb_caravel.pexsimlog
xschem/gpio/results/armleo_gpio_tb_caravel.pexsimlog: xschem/gpio/netlists/armleo_gpio_tb_caravel.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_tb_caravel.pexraw" -o "../xschem/gpio/results/armleo_gpio_tb_caravel.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_tb_caravel.pexspice"
cd -
.PRECIOUS: gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice
xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice: xschem/gpio/testbenches/armleo_gpio_lv2hv_tb_1v8.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_lv2hv_tb_1v8.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.simlog
xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.simlog: xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.raw" -o "../xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.simlog" "../xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.pexspice
xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.pexspice: xschem/gpio/results/armleo_gpio_lv2hv.pexspice xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio_lv2hv xschem/gpio/results/armleo_gpio_lv2hv.pexspice xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.spice xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.pexsimlog
xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.pexsimlog: xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.pexraw" -o "../xschem/gpio/results/armleo_gpio_lv2hv_tb_1v8.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_lv2hv_tb_1v8.pexspice"
cd -
.PRECIOUS: gpio/netlists/armleo_gpio_lv2hv_tb.spice
xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice: xschem/gpio/testbenches/armleo_gpio_lv2hv_tb.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_lv2hv_tb.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv_tb.simlog
xschem/gpio/results/armleo_gpio_lv2hv_tb.simlog: xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_lv2hv_tb.raw" -o "../xschem/gpio/results/armleo_gpio_lv2hv_tb.simlog" "../xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_lv2hv_tb.pexspice
xschem/gpio/netlists/armleo_gpio_lv2hv_tb.pexspice: xschem/gpio/results/armleo_gpio_lv2hv.pexspice xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio_lv2hv xschem/gpio/results/armleo_gpio_lv2hv.pexspice xschem/gpio/netlists/armleo_gpio_lv2hv_tb.spice xschem/gpio/netlists/armleo_gpio_lv2hv_tb.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_lv2hv_tb.pexsimlog
xschem/gpio/results/armleo_gpio_lv2hv_tb.pexsimlog: xschem/gpio/netlists/armleo_gpio_lv2hv_tb.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_lv2hv_tb.pexraw" -o "../xschem/gpio/results/armleo_gpio_lv2hv_tb.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_lv2hv_tb.pexspice"
cd -
.PRECIOUS: gpio/netlists/armleo_gpio_esd_tb.spice
xschem/gpio/netlists/armleo_gpio_esd_tb.spice: xschem/gpio/testbenches/armleo_gpio_esd_tb.sch uncompress Makefile
$(CHECKS)
cd xschem \
&& xschem --rcfile ${PDK_ROOT}/sky130A/libs.tech/xschem/xschemrc -q -n gpio/testbenches/armleo_gpio_esd_tb.sch -o gpio/netlists/ \
&& cd -
.PRECIOUS: xschem/gpio/results/armleo_gpio_esd_tb.simlog
xschem/gpio/results/armleo_gpio_esd_tb.simlog: xschem/gpio/netlists/armleo_gpio_esd_tb.spice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_esd_tb.raw" -o "../xschem/gpio/results/armleo_gpio_esd_tb.simlog" "../xschem/gpio/netlists/armleo_gpio_esd_tb.spice"
cd -
.PRECIOUS: xschem/gpio/netlists/armleo_gpio_esd_tb.pexspice
xschem/gpio/netlists/armleo_gpio_esd_tb.pexspice: xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_esd_tb.spice uncompress Makefile
python3 scripts/make_pextb.py armleo_gpio xschem/gpio/results/armleo_gpio.pexspice xschem/gpio/netlists/armleo_gpio_esd_tb.spice xschem/gpio/netlists/armleo_gpio_esd_tb.pexspice
.PRECIOUS: xschem/gpio/results/armleo_gpio_esd_tb.pexsimlog
xschem/gpio/results/armleo_gpio_esd_tb.pexsimlog: xschem/gpio/netlists/armleo_gpio_esd_tb.pexspice uncompress Makefile
$(CHECKS)
cd xschem
ngspice -r "../xschem/gpio/results/armleo_gpio_esd_tb.pexraw" -o "../xschem/gpio/results/armleo_gpio_esd_tb.pexsimlog" "../xschem/gpio/netlists/armleo_gpio_esd_tb.pexspice"
cd -
lef/armleo_gpio.lef: gds/user_analog_project_wrapper.gds uncompress Makefile scripts/armleo_gpio_lef.tcl
cd temp && \
MAGIC_GDS_FILE=../gds/user_analog_project_wrapper.gds \
MAGIC_LEF_FILE=../lef/armleo_gpio.lef \
TOP_CELL=armleo_gpio \
magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -dnull -noconsole ../scripts/armleo_gpio_lef.tcl\
&& cd -
# cannot commit files larger than 100 MB to GitHub
FILE_SIZE_LIMIT_MB = 20
# Commands to be used to compress/uncompress files
# they must operate **in place** (otherwise, modify the target to delete the
# intermediate file/archive)
COMPRESS ?= gzip -n --best
UNCOMPRESS ?= gzip -d
ARCHIVE_EXT ?= gz
# The following variables are to build static pattern rules
# Needed to rebuild archives that were previously split
SPLIT_FILES := $(shell find . -type f -name "*.$(ARCHIVE_EXT).00.split")
SPLIT_FILES_SOURCES := $(basename $(basename $(basename $(SPLIT_FILES))))
# Needed to uncompress the existing archives
ARCHIVES := $(shell find . -type f -name "*.$(ARCHIVE_EXT)")
ARCHIVE_SOURCES := $(basename $(ARCHIVES))
# Needed to compress and split files/archives that are too large
LARGE_FILES := $(shell find ./gds -type f -name "*.gds")
# LARGE_FILES += $(shell find ./gds -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*" -not -path "./gds/*" -not -path "./oas/*" -not -path "./openlane/*")
LARGE_FILES_GZ := $(addsuffix .$(ARCHIVE_EXT), $(LARGE_FILES))
LARGE_FILES_GZ_SPLIT := $(addsuffix .$(ARCHIVE_EXT).00.split, $(LARGE_FILES))
# consider splitting existing archives
LARGE_FILES_GZ_SPLIT += $(addsuffix .00.split, $(ARCHIVES))
#####
$(LARGE_FILES_GZ): %.$(ARCHIVE_EXT): %
@if ! [ $(suffix $<) = ".$(ARCHIVE_EXT)" ]; then\
$(COMPRESS) $< > /dev/null &&\
echo "$< -> $@";\
fi
$(LARGE_FILES_GZ_SPLIT): %.$(ARCHIVE_EXT).00.split: %.$(ARCHIVE_EXT)
@if [ -n "$$(find "$<" -prune -size +$(FILE_SIZE_LIMIT_MB)M)" ]; then\
split $< -b $(FILE_SIZE_LIMIT_MB)M $<. -d &&\
rm $< &&\
for file in $$(ls $<.*); do mv "$$file" "$$file.split"; done &&\
echo -n "$< -> $$(ls $<.*.split)" | tr '\n' ' ' && echo "";\
fi
# This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB
.PHONY: compress
compress: $(LARGE_FILES_GZ) $(LARGE_FILES_GZ_SPLIT)
@echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!"
#####
$(ARCHIVE_SOURCES): %: %.$(ARCHIVE_EXT)
@$(UNCOMPRESS) $<
@echo "$< -> $@"
.SECONDEXPANSION:
$(SPLIT_FILES_SOURCES): %: $$(sort $$(wildcard %.$(ARCHIVE_EXT).*.split))
@cat $? > $@.$(ARCHIVE_EXT)
@rm $?
@echo "$? -> $@.$(ARCHIVE_EXT)"
@$(UNCOMPRESS) $@.$(ARCHIVE_EXT)
@echo "$@.$(ARCHIVE_EXT) -> $@"
.PHONY: uncompress
uncompress: $(SPLIT_FILES_SOURCES) $(ARCHIVE_SOURCES)
@echo "All files are uncompressed!"