Skip to content

Commit a9a96a1

Browse files
committed
use latest Makefile to allow parallel builds
1 parent aa07cf3 commit a9a96a1

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

graphics/gpu/mipmap_fog/Makefile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ else
9595
endif
9696
#---------------------------------------------------------------------------------
9797

98-
export OFILES := $(addsuffix .o,$(BINFILES)) \
99-
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \
100-
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
98+
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
99+
100+
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \
101+
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o)
102+
103+
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
104+
105+
export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
101106

102107
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
103108
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
@@ -155,12 +160,14 @@ else
155160
$(OUTPUT).3dsx : $(OUTPUT).elf
156161
endif
157162

163+
$(OFILES_SOURCES) : $(HFILES)
164+
158165
$(OUTPUT).elf : $(OFILES)
159166

160167
#---------------------------------------------------------------------------------
161168
# you need a rule like this for each extension you use as binary data
162169
#---------------------------------------------------------------------------------
163-
%.bin.o : %.bin
170+
%.bin.o %_bin.h : %.bin
164171
#---------------------------------------------------------------------------------
165172
@echo $(notdir $<)
166173
@$(bin2o)
@@ -169,25 +176,27 @@ $(OUTPUT).elf : $(OFILES)
169176
# rules for assembling GPU shaders
170177
#---------------------------------------------------------------------------------
171178
define shader-as
172-
$(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@)))
173-
picasso -o $(CURBIN) $1
174-
bin2s $(CURBIN) | $(AS) -o $@
179+
$(eval CURBIN := $*.shbin)
180+
$(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d)
181+
echo "$(CURBIN).o: $< $1" > $(DEPSFILE)
175182
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
176183
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
177184
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
185+
picasso -o $(CURBIN) $1
186+
bin2s $(CURBIN) | $(AS) -o $*.shbin.o
178187
endef
179188

180-
%.shbin.o : %.v.pica %.g.pica
189+
%.shbin.o %_shbin.h : %.v.pica %.g.pica
181190
@echo $(notdir $^)
182191
@$(call shader-as,$^)
183192

184-
%.shbin.o : %.v.pica
193+
%.shbin.o %_shbin.h : %.v.pica
185194
@echo $(notdir $<)
186195
@$(call shader-as,$<)
187196

188-
%.shbin.o : %.shlist
197+
%.shbin.o %_shbin.h : %.shlist
189198
@echo $(notdir $<)
190-
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
199+
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file)))
191200

192201
-include $(DEPENDS)
193202

0 commit comments

Comments
 (0)