add BINDIR in Makefile
the obj and bin files are stored under source code directory, would like to add a BINDIR in Makefile, to support parralle make for different target.
BINDIR is normally used to install executables to. http-parser however doesn't produce executables, only libraries. (I'm ignoring the test runner; it isn't installed.)
Perhaps what you're really asking for is VPATH support for out-of-tree builds?
maybe BINDIR is not a good name, it is the direcotry where obj and exe files are stored during make, it can solve problem when running parralle make with different arch,
change looks like:
BINDIR ?= $(CURDIR)
test: $(BINDIR)/test_g $(BINDIR)/test_fast $(HELPER) $(BINDIR)/test_g$(BINEXT) $(HELPER) $(BINDIR)/test_fast$(BINEXT)
$(BINDIR)/test_g: $(BINDIR)/http_parser_g.o $(BINDIR)/test_g.o $(CC) $(CFLAGS_DEBUG) $(LDFLAGS) -o $@ $^
$(BINDIR)/test_g.o: test.c http_parser.h Makefile $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@
$(BINDIR)/http_parser_g.o: http_parser.c http_parser.h Makefile $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@
Right, that's traditionally solved with VPATH, although your approach works too for simple projects.
What you call BINDIR is usually called BUILDDIR or sometimes just B. Pull requests welcome but note that I plan on switching to cmake sometime this year and cmake gives you out-of-tree builds for free.