Added add_share_file Makefile macro
authorClifford Wolf <clifford@clifford.at>
Wed, 7 Jan 2015 23:23:18 +0000 (00:23 +0100)
committerClifford Wolf <clifford@clifford.at>
Wed, 7 Jan 2015 23:23:18 +0000 (00:23 +0100)
Makefile
techlibs/common/Makefile.inc
techlibs/xilinx/Makefile.inc

index 38e892131d469e74f51b15625d34339a79b1a16c..8d2e7679d34da6aec3e8411a8ac902c10851c78c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -143,6 +143,13 @@ ifeq ($(ENABLE_COVER),1)
 CXXFLAGS += -DYOSYS_ENABLE_COVER
 endif
 
+define add_share_file
+EXTRA_TARGETS += $(1)/$(notdir $(2))
+$(1)/$(notdir $(2)): $(2)
+       $$(P) mkdir -p $(1)
+       $$(Q) cp $(2) $(1)/$(notdir $(2))
+endef
+
 ifeq ($(PRETTY), 1)
 P_STATUS = 0
 P_OFFSET = 0
index 0607ca1a16886cfad9b0b32189e55ca32e3fa7d2..dc1e0ef66170b443461cf2ed7153be8601bad56e 100644 (file)
@@ -9,29 +9,10 @@ techlibs/common/blackbox.v: techlibs/common/blackbox.sed techlibs/common/simlib.
        $(P) cat techlibs/common/simlib.v techlibs/common/simcells.v | $(SED) -rf techlibs/common/blackbox.sed > techlibs/common/blackbox.v.new
        $(Q) mv techlibs/common/blackbox.v.new techlibs/common/blackbox.v
 
-EXTRA_TARGETS += share/simlib.v share/simcells.v share/techmap.v share/blackbox.v share/pmux2mux.v share/adff2dff.v
-
-share/simlib.v: techlibs/common/simlib.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/simlib.v share/simlib.v
-
-share/simcells.v: techlibs/common/simcells.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/simcells.v share/simcells.v
-
-share/techmap.v: techlibs/common/techmap.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/techmap.v share/techmap.v
-
-share/blackbox.v: techlibs/common/blackbox.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/blackbox.v share/blackbox.v
-
-share/pmux2mux.v: techlibs/common/pmux2mux.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/pmux2mux.v share/pmux2mux.v
-
-share/adff2dff.v: techlibs/common/adff2dff.v
-       $(P) mkdir -p share
-       $(Q) cp techlibs/common/adff2dff.v share/adff2dff.v
+$(eval $(call add_share_file,share,techlibs/common/simlib.v))
+$(eval $(call add_share_file,share,techlibs/common/simcells.v))
+$(eval $(call add_share_file,share,techlibs/common/techmap.v))
+$(eval $(call add_share_file,share,techlibs/common/blackbox.v))
+$(eval $(call add_share_file,share,techlibs/common/pmux2mux.v))
+$(eval $(call add_share_file,share,techlibs/common/adff2dff.v))
 
index 64ee9597cc66576b40265d3efe85e37c01178253..b653660fa5f123ec1d1e1a01113f3631e5f0bbd0 100644 (file)
@@ -1,17 +1,8 @@
 
 OBJS += techlibs/xilinx/synth_xilinx.o
 
-EXTRA_TARGETS += share/xilinx/cells.v share/xilinx/brams.txt share/xilinx/brams.v
-
-share/xilinx/cells.v: techlibs/xilinx/cells.v
-       $(P) mkdir -p share/xilinx
-       $(Q) cp techlibs/xilinx/cells.v share/xilinx/cells.v
-
-share/xilinx/brams.txt: techlibs/xilinx/brams.txt
-       $(P) mkdir -p share/xilinx
-       $(Q) cp techlibs/xilinx/brams.txt share/xilinx/brams.txt
-
-share/xilinx/brams.v: techlibs/xilinx/brams.v
-       $(P) mkdir -p share/xilinx
-       $(Q) cp techlibs/xilinx/brams.v share/xilinx/brams.v
+$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/cells.v))
+$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/cells_sim.v))
+$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/brams.txt))
+$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/brams.v))