blob: e0a9e5cded81c57ba6594402036285adec186313 [file] [log] [blame]
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +02001FILE_SIZE_LIMIT_MB = 10
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +02002LARGE_FILES := $(shell find . -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*")
3
4LARGE_FILES_GZ := $(addsuffix .gz, $(LARGE_FILES))
5
6ARCHIVES := $(shell find . -type f -name "*.gz")
7ARCHIVE_SOURCES := $(basename $(ARCHIVES))
8
Ahmed Ghazyefdc5292020-11-19 16:05:48 +02009
10.DEFAULT_GOAL := ship
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020011# We need portable GDS_FILE pointers...
12.PHONY: ship
13ship: uncompress
agorararmard7d6fadb2020-11-25 20:23:20 +020014 ifndef PDK_ROOT
15 $(error PDK_ROOT is undefined, please export it before running make)
16 endif
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020017 @echo "###############################################"
18 @echo "Generating Caravel GDS (sources are in the 'gds' directory)"
19 @sleep 1
Ahmed Ghazy0252f542020-11-25 14:45:38 +020020 @cd gds && MAGTYPE=mag magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/current/sky130A.magicrc -noc -dnull gen_caravel.tcl < /dev/null
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020021
22
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020023
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020024.PHONY: clean
25clean:
26 echo "clean"
27
28
29
30.PHONY: verify
31verify:
32 echo "verify"
33
34
35
36$(LARGE_FILES_GZ): %.gz: %
Ahmed Ghazy0252f542020-11-25 14:45:38 +020037 @if ! [ $(suffix $<) == ".gz" ]; then\
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020038 gzip -n --best $< > /dev/null &&\
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020039 echo "$< -> $@";\
40 fi
41
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020042# This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020043.PHONY: compress
44compress: $(LARGE_FILES_GZ)
45 @echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!"
46
47
48
49$(ARCHIVE_SOURCES): %: %.gz
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020050 @gzip -d $< &&\
51 echo "$< -> $@";\
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020052
53.PHONY: uncompress
54uncompress: $(ARCHIVE_SOURCES)
55 @echo "All files are uncompressed!"