lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | CUR_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) |
| 2 | PRJ_DIR := $(realpath ${CUR_DIR}/../) |
| 3 | export PRJ_DIR |
| 4 | |
| 5 | IPS ?= uart \ |
| 6 | gpio \ |
| 7 | rv_plic \ |
| 8 | flash_ctrl \ |
| 9 | spi_device \ |
| 10 | rv_timer \ |
| 11 | hmac \ |
| 12 | usbuart |
| 13 | |
Eunchan Kim | 49634d7 | 2019-09-05 14:39:57 -0700 | [diff] [blame] | 14 | TOPS ?= top_earlgrey |
| 15 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 16 | ips_reg = $(addsuffix _reg, $(IPS)) |
| 17 | |
Eunchan Kim | 49634d7 | 2019-09-05 14:39:57 -0700 | [diff] [blame] | 18 | tops_gen = $(addsuffix _gen,$(TOPS)) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 19 | |
| 20 | all: $(ips_reg) |
| 21 | |
| 22 | regs: $(ips_reg) |
| 23 | |
| 24 | $(ips_reg): |
| 25 | if [ -f ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$(subst _reg,,$@).hjson ]; then \ |
| 26 | ${PRJ_DIR}/util/regtool.py -r ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$(subst _reg,,$@).hjson; \ |
| 27 | ${PRJ_DIR}/util/regtool.py -D -o ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/sw/$(subst _reg,_regs,$@).h\ |
| 28 | ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$(subst _reg,,$@).hjson; \ |
| 29 | ${PRJ_DIR}/util/regtool.py -s -t ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/dv/env \ |
| 30 | ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)//doc/$(subst _reg,,$@).hjson; \ |
| 31 | else if [ -f ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$@.hjson ]; then \ |
| 32 | ${PRJ_DIR}/util/regtool.py -r ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$@.hjson; \ |
| 33 | ${PRJ_DIR}/util/regtool.py -D -o ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/sw/$(subst _reg,_regs,$@).h \ |
| 34 | ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/doc/$@.hjson; \ |
| 35 | ${PRJ_DIR}/util/regtool.py -s -t ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)/dv/env \ |
| 36 | ${PRJ_DIR}/hw/ip/$(subst _reg,,$@)//doc/$@.hjson; \ |
| 37 | fi \ |
| 38 | fi |
| 39 | |
Eunchan Kim | 49634d7 | 2019-09-05 14:39:57 -0700 | [diff] [blame] | 40 | $(tops_gen): |
| 41 | $(eval $@_TOP := $(strip $(foreach top,$(TOPS),$(findstring $(top),$@)))) |
| 42 | ${PRJ_DIR}/util/topgen.py -t ${PRJ_DIR}/hw/$($@_TOP)/doc/$($@_TOP).hjson \ |
| 43 | --tpl ${PRJ_DIR}/hw/$($@_TOP)/doc/$($@_TOP).tpl.sv \ |
| 44 | -o ${PRJ_DIR}/hw/$($@_TOP)/ -v |
| 45 | ${PRJ_DIR}/util/topgen.py -t ${PRJ_DIR}/hw/$($@_TOP)/doc/$($@_TOP).hjson \ |
| 46 | -r -o ${PRJ_DIR}/hw/$($@_TOP)/dv/env/ -v |
| 47 | |
| 48 | .PHONY: all $(ips_reg) $(tops_gen) |