btcs

bitcoin script parser/evaluator/compiler/decompiler
git clone git://jb55.com/btcs
Log | Files | Refs | README | LICENSE

commit 21379dfb5b5c4d7f0d863d1067e05713484e2635
parent 774fe39af0eaa1cefb26ec327b66bd839dbe8b17
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 25 Oct 2017 21:16:56 -0700

makefile: better dependency resolution

Diffstat:
M.gitignore | 1+
MMakefile | 42++++++++++++++++++++++++++++++------------
2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -4,3 +4,4 @@ /lex.yy.c /btcs /TAGS +*.d diff --git a/Makefile b/Makefile @@ -1,24 +1,36 @@ CFLAGS=-O0 -g -Wall -Wno-unused-variable -FORBIN=script.o \ - parser.tab.o \ - lex.yy.o \ - oplookup.o \ - op.o \ - main.o \ - stack.o - -GEN=parser.tab.c parser.tab.h lex.yy.c oplookup.c oplookup.h $(FORBIN) +OBJS=script.o \ + parser.tab.o \ + lex.yy.o \ + oplookup.o \ + op.o \ + main.o \ + stack.o + +GEN=parser.tab.c \ + parser.tab.h \ + lex.yy.c \ + oplookup.c \ + oplookup.h \ + $(OBJS) DEPS=oplookup.h script.h misc.h Makefile op.h stack.h PREFIX ?= /usr/local BIN=btcs - all: $(BIN) +include $(OBJS:.o=.d) + +op.c: oplookup.h oplookup.c + +%.d: %.c + @rm -f $@; \ + $(CC) -MM $(CFLAGS) $< > $@ + oplookup.c oplookup.h: opcodes mph-opcodes @./mph-opcodes opcodes @@ -32,8 +44,14 @@ install: $(BIN) mkdir -p $(PREFIX)/bin cp $(BIN) $(PREFIX)/bin -$(BIN): $(GEN) $(DEPS) $(FORBIN) - $(CC) $(CFLAGS) -o $@ $(FORBIN) +$(BIN): $(GEN) $(DEPS) $(OBJS) + $(CC) $(CFLAGS) -o $@ $(OBJS) clean: rm -f $(GEN) + rm -f *.d + +TAGS: + etags -o - *.c > $@ + +.PHONY: TAGS