Ahmed Ghazy | 31c3465 | 2020-12-01 19:59:44 +0200 | [diff] [blame] | 1 | # cannot commit files larger than 100 MB to GitHub |
| 2 | FILE_SIZE_LIMIT_MB = 100 |
| 3 | LARGE_FILES := $(shell find ./gds -type f -name "*.gds") |
Ahmed Ghazy | 0011f61 | 2020-12-02 22:53:33 +0200 | [diff] [blame] | 4 | LARGE_FILES += $(shell find . -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*" -not -path "./gds/*" -not -path "./openlane/*") |
Ahmed Ghazy | 5898e4a | 2020-11-13 22:28:55 +0200 | [diff] [blame] | 5 | |
| 6 | LARGE_FILES_GZ := $(addsuffix .gz, $(LARGE_FILES)) |
| 7 | |
| 8 | ARCHIVES := $(shell find . -type f -name "*.gz") |
| 9 | ARCHIVE_SOURCES := $(basename $(ARCHIVES)) |
| 10 | |
agorararmard | 212cd82 | 2020-11-26 22:40:17 +0200 | [diff] [blame] | 11 | # PDK setup configs |
| 12 | THREADS ?= $(shell nproc) |
| 13 | STD_CELL_LIBRARY ?= sky130_fd_sc_hd |
| 14 | SPECIAL_VOLTAGE_LIBRARY ?= sky130_fd_sc_hvl |
| 15 | IO_LIBRARY ?= sky130_fd_io |
agorararmard | fed74ec | 2020-12-01 18:03:46 +0200 | [diff] [blame] | 16 | SKYWATER_COMMIT ?= 3d7617a1acb92ea883539bcf22a632d6361a5de4 |
agorararmard | c73c7ca | 2020-12-02 21:00:02 +0000 | [diff] [blame] | 17 | OPEN_PDKS_COMMIT ?= 3959de867a4acb6867df376dac495e33bb0734f1 |
Ahmed Ghazy | efdc529 | 2020-11-19 16:05:48 +0200 | [diff] [blame] | 18 | |
| 19 | .DEFAULT_GOAL := ship |
Ahmed Ghazy | efdc529 | 2020-11-19 16:05:48 +0200 | [diff] [blame] | 20 | # We need portable GDS_FILE pointers... |
| 21 | .PHONY: ship |
agorararmard | 212cd82 | 2020-11-26 22:40:17 +0200 | [diff] [blame] | 22 | ship: check-env uncompress |
Ahmed Ghazy | efdc529 | 2020-11-19 16:05:48 +0200 | [diff] [blame] | 23 | @echo "###############################################" |
| 24 | @echo "Generating Caravel GDS (sources are in the 'gds' directory)" |
| 25 | @sleep 1 |
agorararmard | f8e91c3 | 2020-11-30 23:59:58 +0200 | [diff] [blame] | 26 | @cp gds/caravel.gds gds/caravel.old.gds && echo "Copying old Caravel to gds/caravel.old.gds" || true |
Ahmed Ghazy | 0252f54 | 2020-11-25 14:45:38 +0200 | [diff] [blame] | 27 | @cd gds && MAGTYPE=mag magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/current/sky130A.magicrc -noc -dnull gen_caravel.tcl < /dev/null |
Ahmed Ghazy | efdc529 | 2020-11-19 16:05:48 +0200 | [diff] [blame] | 28 | |
| 29 | |
Ahmed Ghazy | e4c7ec5 | 2020-11-20 13:10:15 +0200 | [diff] [blame] | 30 | |
Ahmed Ghazy | 5898e4a | 2020-11-13 22:28:55 +0200 | [diff] [blame] | 31 | .PHONY: clean |
| 32 | clean: |
| 33 | echo "clean" |
| 34 | |
| 35 | |
| 36 | |
| 37 | .PHONY: verify |
| 38 | verify: |
| 39 | echo "verify" |
| 40 | |
| 41 | |
| 42 | |
| 43 | $(LARGE_FILES_GZ): %.gz: % |
Ahmed Ghazy | 0252f54 | 2020-11-25 14:45:38 +0200 | [diff] [blame] | 44 | @if ! [ $(suffix $<) == ".gz" ]; then\ |
Ahmed Ghazy | e4c7ec5 | 2020-11-20 13:10:15 +0200 | [diff] [blame] | 45 | gzip -n --best $< > /dev/null &&\ |
Ahmed Ghazy | 5898e4a | 2020-11-13 22:28:55 +0200 | [diff] [blame] | 46 | echo "$< -> $@";\ |
| 47 | fi |
| 48 | |
Ahmed Ghazy | e4c7ec5 | 2020-11-20 13:10:15 +0200 | [diff] [blame] | 49 | # This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB |
Ahmed Ghazy | 5898e4a | 2020-11-13 22:28:55 +0200 | [diff] [blame] | 50 | .PHONY: compress |
| 51 | compress: $(LARGE_FILES_GZ) |
| 52 | @echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!" |
| 53 | |
| 54 | |
| 55 | |
| 56 | $(ARCHIVE_SOURCES): %: %.gz |
Ahmed Ghazy | e4c7ec5 | 2020-11-20 13:10:15 +0200 | [diff] [blame] | 57 | @gzip -d $< &&\ |
| 58 | echo "$< -> $@";\ |
Ahmed Ghazy | 5898e4a | 2020-11-13 22:28:55 +0200 | [diff] [blame] | 59 | |
| 60 | .PHONY: uncompress |
| 61 | uncompress: $(ARCHIVE_SOURCES) |
| 62 | @echo "All files are uncompressed!" |
agorararmard | 212cd82 | 2020-11-26 22:40:17 +0200 | [diff] [blame] | 63 | |
| 64 | .PHONY: pdk |
| 65 | pdk: 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 |
| 71 | skywater-pdk: check-env $(PDK_ROOT)/skywater-pdk |
| 72 | cd $(PDK_ROOT)/skywater-pdk && \ |
| 73 | git checkout -qf $(SKYWATER_COMMIT) |
| 74 | |
| 75 | .PHONY: skywater-library |
| 76 | skywater-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 |
| 88 | open_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 |
| 93 | build-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 | |
| 106 | check-env: |
| 107 | ifndef PDK_ROOT |
| 108 | $(error PDK_ROOT is undefined, please export it before running make) |
Ahmed Ghazy | 31c3465 | 2020-12-01 19:59:44 +0200 | [diff] [blame] | 109 | endif |