ports/unix/check: Split depfiles for faster build

Having just one depfile (.depend) means it has to be fully regenerated
on every change, and it can't be done in parallel.

After this change the rebuild time after touching a single test file has
gone from 5.0 to 0.9 seconds. (make -j12)

Build of tests from clean has gone from 8.1 to 5.5s.

We could go even further and have one depfile per c-file, but this felt
like a simple first step giving a nice improvement.
This commit is contained in:
Erik Ekman 2020-12-03 21:32:47 +01:00
parent c748395bda
commit 63fb3721ef
2 changed files with 14 additions and 8 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@
*lwip_unittests.xml *lwip_unittests.xml
*.suo *.suo
*.log *.log
.depend .depend*
/.vscode/ipch /.vscode/ipch

View File

@ -57,22 +57,28 @@ TESTDIR=$(LWIPDIR)/../test/unit
include $(TESTDIR)/Filelists.mk include $(TESTDIR)/Filelists.mk
TESTOBJS=$(notdir $(TESTFILES:.c=.o)) TESTOBJS=$(notdir $(TESTFILES:.c=.o))
DEPFILES=.depend_test .depend_lwip .depend_app
clean: clean:
@rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests *.s .depend* *.core core lwip_unittests.xml @rm -f *.o $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests *.s $(DEPFILES) *.core core lwip_unittests.xml
depend dep: .depend depend dep: $(DEPFILES)
include .depend include $(DEPFILES)
.depend: $(LWIPFILES) $(APPFILES) $(TESTFILES) .depend_test: $(TESTFILES)
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend $(CCDEP) $(CFLAGS) -MM $^ > .depend_test || rm -f .depend_test
.depend_lwip: $(LWIPFILES)
$(CCDEP) $(CFLAGS) -MM $^ > .depend_lwip || rm -f .depend_lwip
.depend_app: $(APPFILES)
$(CCDEP) $(CFLAGS) -MM $^ > .depend_app || rm -f .depend_app
ifneq ($(UNAME_S),Darwin) ifneq ($(UNAME_S),Darwin)
# clang on Darwin doesn't support --start-group # clang on Darwin doesn't support --start-group
lwip_unittests: .depend $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests: $(DEPFILES) $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB)
$(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) -Wl,--start-group $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS) -Wl,--end-group $(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) -Wl,--start-group $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS) -Wl,--end-group
else else
lwip_unittests: .depend $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB) lwip_unittests: $(DEPFILES) $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB)
$(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS) $(CC) $(CFLAGS) -o lwip_unittests $(TESTOBJS) $(LWIPLIBCOMMON) $(APPLIB) $(LDFLAGS)
endif endif