Mikael Starvik | 51533b6 | 2005-07-27 11:44:44 -0700 | [diff] [blame] | 1 | # $Id: Makefile,v 1.8 2004/01/07 21:16:18 johana Exp $ |
| 2 | # Makefile to generate or copy the latest register definitions |
| 3 | # and related datastructures and helpermacros. |
| 4 | # The offical place for these files is at: |
| 5 | RELEASE ?= r1_alfa5 |
| 6 | OFFICIAL_INCDIR = /n/asic/projects/guinness/releases/$(RELEASE)/design/top/sw/include/ |
| 7 | |
| 8 | # which is updated on each new release. |
| 9 | INCL_ASMFILES = |
| 10 | INCL_FILES = ata_defs.h |
| 11 | INCL_FILES += bif_core_defs.h |
| 12 | INCL_ASMFILES += bif_core_defs_asm.h |
| 13 | INCL_FILES += bif_slave_defs.h |
| 14 | #INCL_FILES += bif_slave_ext_defs.h |
| 15 | INCL_FILES += config_defs.h |
| 16 | INCL_ASMFILES += config_defs_asm.h |
| 17 | INCL_FILES += cpu_vect.h |
| 18 | #INCL_FILES += cris_defs.h |
| 19 | #INCL_FILES += cris_supp_reg.h # In handcrafted supp_reg.h |
| 20 | INCL_FILES += dma.h |
| 21 | INCL_FILES += dma_defs.h |
| 22 | INCL_FILES += eth_defs.h |
| 23 | INCL_FILES += extmem_defs.h |
| 24 | INCL_FILES += gio_defs.h |
| 25 | INCL_ASMFILES += gio_defs_asm.h |
| 26 | INCL_FILES += intr_vect.h |
| 27 | INCL_FILES += intr_vect_defs.h |
| 28 | INCL_ASMFILES += intr_vect_defs_asm.h |
| 29 | INCL_FILES += marb_bp_defs.h |
| 30 | INCL_FILES += marb_defs.h |
| 31 | INCL_ASMFILES += mmu_defs_asm.h |
| 32 | #INCL_FILES += mmu_supp_reg.h # In handcrafted supp_reg.h |
| 33 | #INCL_FILES += par_defs.h # No useful content |
| 34 | INCL_FILES += pinmux_defs.h |
| 35 | INCL_FILES += reg_map.h |
| 36 | INCL_ASMFILES += reg_map_asm.h |
| 37 | INCL_FILES += reg_rdwr.h |
| 38 | INCL_FILES += ser_defs.h |
| 39 | #INCL_FILES += spec_reg.h # In handcrafted supp_reg.h |
| 40 | INCL_FILES += sser_defs.h |
| 41 | INCL_FILES += strcop_defs.h |
| 42 | #INCL_FILES += strcop.h # Where is this? |
| 43 | INCL_FILES += strmux_defs.h |
| 44 | #INCL_FILES += supp_reg.h # Handcrafted instead |
| 45 | INCL_FILES += timer_defs.h |
| 46 | |
| 47 | REGDESC = |
| 48 | REGDESC += $(BASEDIR)/io/ata/rtl/ata_regs.r |
| 49 | REGDESC += $(BASEDIR)/io/bif/rtl/bif_core_regs.r |
| 50 | REGDESC += $(BASEDIR)/io/bif/rtl/bif_slave_regs.r |
| 51 | #REGDESC += $(BASEDIR)/io/bif/sw/bif_slave_ext_regs.r |
| 52 | REGDESC += $(DESIGNDIR)/top/rtl/config_regs.r |
| 53 | REGDESC += $(BASEDIR)/mod/dma_common/rtl/dma_regdes.r |
| 54 | REGDESC += $(BASEDIR)/io/eth/rtl/eth_regs.r |
| 55 | REGDESC += $(BASEDIR)/io/bif/mod/extmem/extmem_regs.r |
| 56 | REGDESC += $(DESIGNDIR)/gio/rtl/gio_regs.r |
| 57 | REGDESC += $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r |
| 58 | REGDESC += $(BASEDIR)/core/memarb/rtl/guinness/marb_top.r |
| 59 | REGDESC += $(BASEDIR)/core/cpu/mmu/doc/mmu_regs.r |
| 60 | #REGDESC += $(BASEDIR)/io/par_port/rtl/par_regs.r |
| 61 | REGDESC += $(BASEDIR)/io/pinmux/rtl/guinness/pinmux_regs.r |
| 62 | REGDESC += $(BASEDIR)/io/ser/rtl/ser_regs.r |
| 63 | REGDESC += $(BASEDIR)/core/strcop/rtl/strcop_regs.r |
| 64 | REGDESC += $(BASEDIR)/io/strmux/rtl/guinness/strmux_regs.r |
| 65 | REGDESC += $(BASEDIR)/io/timer/rtl/timer_regs.r |
| 66 | #REGDESC += $(BASEDIR)/io/usb/usb1_1/rtl/usb_regs.r |
| 67 | |
| 68 | |
| 69 | BASEDIR = /n/asic/design |
| 70 | DESIGNDIR = /n/asic/projects/guinness/design |
| 71 | RDES2C = /n/asic/bin/rdes2c |
| 72 | RDES2C = /n/asic/design/tools/rdesc/rdes2c |
| 73 | RDES2INTR = /n/asic/design/tools/rdesc/rdes2intr |
| 74 | RDES2TXT = /n/asic/design/tools/rdesc/rdes2txt |
| 75 | |
| 76 | ## all - Just print help - you probably want to do 'make gen' |
| 77 | all: help |
| 78 | |
| 79 | # Disable implicit rule that may generate deleted files from RCS/ directory. |
| 80 | %.r: |
| 81 | |
| 82 | %.h: |
| 83 | |
| 84 | ## help - This help |
| 85 | help: |
| 86 | @grep '^## ' Makefile |
| 87 | |
| 88 | ## gen - Generate include files |
| 89 | gen: $(INCL_FILES) $(INCL_ASMFILES) |
| 90 | |
| 91 | ata_defs.h: $(BASEDIR)/io/ata/rtl/ata_regs.r |
| 92 | $(RDES2C) $< |
| 93 | config_defs.h: $(DESIGNDIR)/top/rtl/config_regs.r |
| 94 | $(RDES2C) $< |
| 95 | config_defs_asm.h: $(DESIGNDIR)/top/rtl/config_regs.r |
| 96 | $(RDES2C) -asm $< |
| 97 | # Can't generate cpu_vect.h yet |
| 98 | #cpu_vect.h: $(DESIGNDIR)/top/rtl/cpu_vect.r # ???? |
| 99 | # $(RDES2INTR) $< |
| 100 | cpu_vect.h: $(OFFICIAL_INCDIR)cpu_vect.h |
| 101 | cat $< | sed -e 's/\$$Id\:/id\:/g' >$@ |
| 102 | dma_defs.h: $(BASEDIR)/core/dma/rtl/common/dma_regdes.r |
| 103 | $(RDES2C) $< |
| 104 | $(BASEDIR)/core/dma/sw/dma.h: |
| 105 | dma.h: $(BASEDIR)/core/dma/sw/dma.h |
| 106 | cat $< | sed -e 's/\$$Id\:/id\:/g' >$@ |
| 107 | eth_defs.h: $(BASEDIR)/io/eth/rtl/eth_regs.r |
| 108 | $(RDES2C) $< |
| 109 | extmem_defs.h: $(BASEDIR)/io/bif/mod/extmem/extmem_regs.r |
| 110 | $(RDES2C) $< |
| 111 | gio_defs.h: $(DESIGNDIR)/gio/rtl/gio_regs.r |
| 112 | $(RDES2C) $< |
| 113 | intr_vect_defs.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r |
| 114 | $(RDES2C) $< |
| 115 | intr_vect_defs_asm.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r |
| 116 | $(RDES2C) -asm $< |
| 117 | # Can't generate intr_vect.h yet |
| 118 | #intr_vect.h: $(BASEDIR)/core/cpu/intr_vect/rtl/guinness/ivmask.config.r |
| 119 | # $(RDES2INTR) $< |
| 120 | intr_vect.h: $(OFFICIAL_INCDIR)intr_vect.h |
| 121 | cat $< | sed -e 's/\$$Id\:/id\:/g' >$@ |
| 122 | mmu_defs_asm.h: $(BASEDIR)/core/cpu/mmu/doc/mmu_regs.r |
| 123 | $(RDES2C) -asm $< |
| 124 | par_defs.h: $(BASEDIR)/io/par_port/rtl/par_regs.r |
| 125 | $(RDES2C) $< |
| 126 | |
| 127 | # From /n/asic/projects/guinness/design/ |
| 128 | reg_map.h: $(DESIGNDIR)/top/rtl/global.rmap $(DESIGNDIR)/top/mod/modreg.rmap |
| 129 | $(RDES2C) -base 0xb0000000 $^ |
| 130 | reg_map_asm.h: $(DESIGNDIR)/top/rtl/global.rmap $(DESIGNDIR)/top/mod/modreg.rmap |
| 131 | $(RDES2C) -base 0xb0000000 -asm -outfile $@ $^ |
| 132 | |
| 133 | reg_rdwr.h: $(DESIGNDIR)/top/sw/include/reg_rdwr.h |
| 134 | cat $< | sed -e 's/\$$Id\:/id\:/g' >$@ |
| 135 | |
| 136 | ser_defs.h: $(BASEDIR)/io/ser/rtl/ser_regs.r |
| 137 | $(RDES2C) $< |
| 138 | strcop_defs.h: $(BASEDIR)/core/strcop/rtl/strcop_regs.r |
| 139 | $(RDES2C) $< |
| 140 | strcop.h: $(BASEDIR)/core/strcop/rtl/strcop.h |
| 141 | cat $< | sed -e 's/\$$Id\:/id\:/g' >$@ |
| 142 | strmux_defs.h: $(BASEDIR)/io/strmux/rtl/guinness/strmux_regs.r |
| 143 | $(RDES2C) $< |
| 144 | timer_defs.h: $(BASEDIR)/io/timer/rtl/timer_regs.r |
| 145 | $(RDES2C) $< |
| 146 | usb_defs.h: $(BASEDIR)/io/usb/usb1_1/rtl/usb_regs.r |
| 147 | $(RDES2C) $< |
| 148 | |
| 149 | ## copy - Copy files from official location |
| 150 | copy: |
| 151 | @for HFILE in $(INCL_FILES); do \ |
| 152 | echo " $$HFILE"; \ |
| 153 | cat $(OFFICIAL_INCDIR)$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \ |
| 154 | done |
| 155 | @for HFILE in $(INCL_ASMFILES); do \ |
| 156 | echo " $$HFILE"; \ |
| 157 | cat $(OFFICIAL_INCDIR)asm/$$HFILE | sed -e 's/\$$Id\:/id\:/g' > $$HFILE; \ |
| 158 | done |
| 159 | ## ls_official - List official location |
| 160 | ls_official: |
| 161 | (cd $(OFFICIAL_INCDIR); ls -l *.h ) |
| 162 | |
| 163 | ## diff_official - Diff current directory with official location |
| 164 | diff_official: |
| 165 | diff . $(OFFICIAL_INCDIR) |
| 166 | |
| 167 | ## doc - Generate .axw files from register description. |
| 168 | doc: $(REGDESC) |
| 169 | for RDES in $^; do \ |
| 170 | $(RDES2TXT) $$RDES; \ |
| 171 | done |
| 172 | |
| 173 | .PHONY: axw |
| 174 | ## %.axw - Generate the specified .axw file (doesn't work for all files |
| 175 | ## due to inconsistent naming ir .r files. |
| 176 | %.axw: axw |
| 177 | @for RDES in $(REGDESC); do \ |
| 178 | if echo "$$RDES" | grep $* ; then \ |
| 179 | $(RDES2TXT) $$RDES; \ |
| 180 | fi \ |
| 181 | done |
| 182 | |
| 183 | .PHONY: clean |
| 184 | ## clean - Remove .h files and .axw files. |
| 185 | clean: |
| 186 | rm -rf $(INCL_FILES) *.axw |
| 187 | |