blob: cbc1c3129fc2248feddb96fd382cc01403b7c9b7 [file] [log] [blame]
Ahmed Ghazy31c34652020-12-01 19:59:44 +02001# cannot commit files larger than 100 MB to GitHub
2FILE_SIZE_LIMIT_MB = 100
3LARGE_FILES := $(shell find ./gds -type f -name "*.gds")
Ahmed Ghazy0011f612020-12-02 22:53:33 +02004LARGE_FILES += $(shell find . -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*" -not -path "./gds/*" -not -path "./openlane/*")
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +02005
6LARGE_FILES_GZ := $(addsuffix .gz, $(LARGE_FILES))
7
8ARCHIVES := $(shell find . -type f -name "*.gz")
9ARCHIVE_SOURCES := $(basename $(ARCHIVES))
10
agorararmard212cd822020-11-26 22:40:17 +020011# PDK setup configs
12THREADS ?= $(shell nproc)
13STD_CELL_LIBRARY ?= sky130_fd_sc_hd
14SPECIAL_VOLTAGE_LIBRARY ?= sky130_fd_sc_hvl
15IO_LIBRARY ?= sky130_fd_io
agorararmardfed74ec2020-12-01 18:03:46 +020016SKYWATER_COMMIT ?= 3d7617a1acb92ea883539bcf22a632d6361a5de4
agorararmardc73c7ca2020-12-02 21:00:02 +000017OPEN_PDKS_COMMIT ?= 3959de867a4acb6867df376dac495e33bb0734f1
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020018
19.DEFAULT_GOAL := ship
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020020# We need portable GDS_FILE pointers...
21.PHONY: ship
agorararmard212cd822020-11-26 22:40:17 +020022ship: check-env uncompress
Ahmed Ghazyefdc5292020-11-19 16:05:48 +020023 @echo "###############################################"
24 @echo "Generating Caravel GDS (sources are in the 'gds' directory)"
25 @sleep 1
agorararmardf8e91c32020-11-30 23:59:58 +020026 @cp gds/caravel.gds gds/caravel.old.gds && echo "Copying old Caravel to gds/caravel.old.gds" || true
Ahmed Ghazy0252f542020-11-25 14:45:38 +020027 @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 +020028
29
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020030
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020031.PHONY: clean
32clean:
33 echo "clean"
34
35
36
37.PHONY: verify
38verify:
39 echo "verify"
40
41
42
43$(LARGE_FILES_GZ): %.gz: %
Ahmed Ghazy0252f542020-11-25 14:45:38 +020044 @if ! [ $(suffix $<) == ".gz" ]; then\
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020045 gzip -n --best $< > /dev/null &&\
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020046 echo "$< -> $@";\
47 fi
48
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020049# This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020050.PHONY: compress
51compress: $(LARGE_FILES_GZ)
52 @echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!"
53
54
55
56$(ARCHIVE_SOURCES): %: %.gz
Ahmed Ghazye4c7ec52020-11-20 13:10:15 +020057 @gzip -d $< &&\
58 echo "$< -> $@";\
Ahmed Ghazy5898e4a2020-11-13 22:28:55 +020059
60.PHONY: uncompress
61uncompress: $(ARCHIVE_SOURCES)
62 @echo "All files are uncompressed!"
agorararmard212cd822020-11-26 22:40:17 +020063
64.PHONY: pdk
65pdk: skywater-pdk skywater-library open_pdks build-pdk
66
67$(PDK_ROOT)/skywater-pdk:
68 git clone https://github.com/google/skywater-pdk.git $(PDK_ROOT)/skywater-pdk
69
70.PHONY: skywater-pdk
71skywater-pdk: check-env $(PDK_ROOT)/skywater-pdk
72 cd $(PDK_ROOT)/skywater-pdk && \
73 git checkout -qf $(SKYWATER_COMMIT)
74
75.PHONY: skywater-library
76skywater-library: check-env $(PDK_ROOT)/skywater-pdk
77 cd $(PDK_ROOT)/skywater-pdk && \
78 git submodule update --init libraries/$(STD_CELL_LIBRARY)/latest && \
79 git submodule update --init libraries/$(IO_LIBRARY)/latest && \
80 git submodule update --init libraries/$(SPECIAL_VOLTAGE_LIBRARY)/latest && \
81 $(MAKE) -j$(THREADS) timing
82
83### OPEN_PDKS
84$(PDK_ROOT)/open_pdks:
85 git clone https://github.com/RTimothyEdwards/open_pdks.git $(PDK_ROOT)/open_pdks
86
87.PHONY: open_pdks
88open_pdks: check-env $(PDK_ROOT)/open_pdks
89 cd $(PDK_ROOT)/open_pdks && \
90 git checkout -qf $(OPEN_PDKS_COMMIT)
91
92.PHONY: build-pdk
93build-pdk: check-env $(PDK_ROOT)/open_pdks $(PDK_ROOT)/skywater-pdk
94 [ -d $(PDK_ROOT)/sky130A ] && \
95 (echo "Warning: A sky130A build already exists under $(PDK_ROOT). It will be deleted first!" && \
96 sleep 5 && \
97 rm -rf $(PDK_ROOT)/sky130A) || \
98 true
99 cd $(PDK_ROOT)/open_pdks && \
100 ./configure --with-sky130-source=$(PDK_ROOT)/skywater-pdk/libraries --with-sky130-local-path=$(PDK_ROOT) && \
101 cd sky130 && \
102 $(MAKE) veryclean && \
103 $(MAKE) && \
104 $(MAKE) install-local
105
106check-env:
107ifndef PDK_ROOT
108 $(error PDK_ROOT is undefined, please export it before running make)
Ahmed Ghazy31c34652020-12-01 19:59:44 +0200109endif