Tools now share a common base makefile

This commit is contained in:
alpine9000
2016-03-13 09:15:27 +11:00
parent 38d0ee41be
commit cfb11f92c9
5 changed files with 58 additions and 73 deletions
+24
View File
@@ -0,0 +1,24 @@
WARN_ERROR=-Werror
HOST_WARNINGS=$(WARN_ERROR) -pedantic-errors -Wfatal-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -limagequant
HOST_CFLAGS=$(HOST_WARNINGS) -O3 $(EXTRA_CFLAGS)
$(PROGRAM): out bin $(OBJS)
gcc $(OBJS) -o $(PROGRAM) $(LIBS)
-include $(OBJS:.o=.d)
out/%.o: %.c
gcc -c $(HOST_CFLAGS) $< -o $@
@gcc -MM $(HOST_CFLAGS) $*.c > out/$*.d
@mv -f out/$*.d out/$*.d.tmp
@sed 's/^.*\:/out\/&/' < out/$*.d.tmp > out/$*.d
@rm -f out/$*.d.tmp
out:
mkdir out
bin:
mkdir bin
clean:
rm -rf out bin *~