From a9a96a1086ea508101d3cc719351301b35df17ea Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Fri, 14 Jul 2017 00:35:44 +0100 Subject: [PATCH] use latest Makefile to allow parallel builds --- graphics/gpu/mipmap_fog/Makefile | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/graphics/gpu/mipmap_fog/Makefile b/graphics/gpu/mipmap_fog/Makefile index a6103f0..09a8632 100644 --- a/graphics/gpu/mipmap_fog/Makefile +++ b/graphics/gpu/mipmap_fog/Makefile @@ -95,9 +95,14 @@ else endif #--------------------------------------------------------------------------------- -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \ + $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) + +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ @@ -155,12 +160,14 @@ else $(OUTPUT).3dsx : $(OUTPUT).elf endif +$(OFILES_SOURCES) : $(HFILES) + $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- # you need a rule like this for each extension you use as binary data #--------------------------------------------------------------------------------- -%.bin.o : %.bin +%.bin.o %_bin.h : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) @@ -169,25 +176,27 @@ $(OUTPUT).elf : $(OFILES) # rules for assembling GPU shaders #--------------------------------------------------------------------------------- define shader-as - $(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@))) - picasso -o $(CURBIN) $1 - bin2s $(CURBIN) | $(AS) -o $@ + $(eval CURBIN := $*.shbin) + $(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d) + echo "$(CURBIN).o: $< $1" > $(DEPSFILE) echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h + picasso -o $(CURBIN) $1 + bin2s $(CURBIN) | $(AS) -o $*.shbin.o endef -%.shbin.o : %.v.pica %.g.pica +%.shbin.o %_shbin.h : %.v.pica %.g.pica @echo $(notdir $^) @$(call shader-as,$^) -%.shbin.o : %.v.pica +%.shbin.o %_shbin.h : %.v.pica @echo $(notdir $<) @$(call shader-as,$<) -%.shbin.o : %.shlist +%.shbin.o %_shbin.h : %.shlist @echo $(notdir $<) - @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file))) + @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file))) -include $(DEPENDS)