Make pmgen support files more generic
authorEddie Hung <eddie@fpgeh.com>
Fri, 26 Apr 2019 00:23:46 +0000 (17:23 -0700)
committerEddie Hung <eddie@fpgeh.com>
Fri, 26 Apr 2019 00:23:46 +0000 (17:23 -0700)
passes/pmgen/.gitignore
passes/pmgen/Makefile.inc

index c9263057e5c5d004ab0df7d834fb78ca5ae04083..52dfd93f370de104b7690811ae1f96b7b30ef924 100644 (file)
@@ -1 +1 @@
-/ice40_dsp_pm.h
+*_pm.h
index e0609d9ba368e1f76e0092bbb0cd60ff63ff4927..5669bd3d1cd57d099ae14ebf37e9bb21c9d39ace 100644 (file)
@@ -1,8 +1,11 @@
-OBJS += passes/pmgen/ice40_dsp.o
+PMG_SRC = $(wildcard passes/pmgen/*.pmg)
+PMG_OBJS += $(patsubst %.pmg, %.o, $(PMG_SRC))
+OBJS += $(PMG_OBJS)
 
-passes/pmgen/ice40_dsp.o: passes/pmgen/ice40_dsp_pm.h
-EXTRA_OBJS += passes/pmgen/ice40_dsp_pm.h
-.SECONDARY: passes/pmgen/ice40_dsp_pm.h
+$(PMG_OBJS): %.o: %_pm.h
 
-passes/pmgen/ice40_dsp_pm.h: passes/pmgen/pmgen.py passes/pmgen/ice40_dsp.pmg
+EXTRA_OBJS += $(patsubst %.pmg, %_pm.h, $(PMG_SRC))
+.SECONDARY: $(EXTRA_OBJS)
+
+%_pm.h: passes/pmgen/pmgen.py %.pmg
        $(P) mkdir -p passes/pmgen && python3 $^ $@