BU-Tools / uHAL_AXI_regmap

Tools for building AXI slave VHDL from uHAL address tables.
Apache License 2.0
4 stars 4 forks source link

Makefile paths #4

Closed andrewpeck closed 3 years ago

andrewpeck commented 4 years ago

In xml_regmap.mk there are some hardcoded paths that conflict with the file structure used by L0MDT.

First, in: https://github.com/BU-Tools/uHAL_AXI_regmap/blob/e1161cef400a03706e261af5ae21ca8d2e24ec63/xml_regmap.mk#L8

Can this be replaced with the ?= operator instead so that we can override it from our own Makefile?

Also in this line I think it would be better in any case to amend the find command with the filetype so that we are not just searching for any symlinks but rather only XML files, e.g.

SYM_LNK_XMLS?= $(shell find ./src -type l -iname "*.xml")

Second, in: https://github.com/BU-Tools/uHAL_AXI_regmap/blob/e1161cef400a03706e261af5ae21ca8d2e24ec63/xml_regmap.mk#L20-L23

the relative path does not play well for me when calling the script from a different Makefile

what I am doing right now that seems to work for both the Hog workflow and the CM_KINTEX_FW is to pass the absolute path of the regmap tool to the XML2VHD_PATH variable so that

  1. in the CM_KINTEX_FW makefile I change the XML2VHD_PATH to
    XML2VHD_PATH=$(shell pwd)/regmap_helper
    ifneq ("$(wildcard $(XML2VHD_PATH)/xml_regmap.mk)","")
        include $(XML2VHD_PATH)/xml_regmap.mk
    endif
  2. Change the call to generate_test_xml and so on in xml_regmap.mk to use this new absolute path
    $(XML2VHD_PATH)/generate_test_xml $(basename $(notdir $<)) &&\
    $(XML2VHD_PATH)/build_vhdl_packages test.xml &&\
  3. In the regmap folder I added very simple a standalone makefile
    #################################################################################
    # Generate MAP and PKG files from address table
    #################################################################################
    export LD_LIBRARY_PATH=/opt/cactus/lib
    XML2VHD_PATH?=$(shell pwd)
    SYM_LNK_XMLS?= $(shell find ../ -type l -name "*.xml")
    include xml_regmap.mk
    .DEFAULT_GOAL := xml_regmap
    clean: clean_regmap

With these changes I can run the XML regmap tool either by simply calling make from the regmap folder (new feature), or by calling make xml_regmap from the root of the project (current behavior).

This gives the flexibility for something like Hog which does not have a central makefile to just execute from Tcl

eval exec bash -c {cd "${path_repo}/regmap" && make clean && make}