aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2009-09-16 14:25:13 -0700
committerChristopher <sparse@chrisli.org>2010-03-28 17:51:36 -0700
commit4ad6779b132efeff0a68a650393ac2ef1fa601b2 (patch)
tree6c27b3f3e342c1892a67accbd7712ee5eaf8024f
parentIgnore the alloc_size attribute. (diff)
downloadsparse-4ad6779b132efeff0a68a650393ac2ef1fa601b2.tar.gz
sparse-4ad6779b132efeff0a68a650393ac2ef1fa601b2.tar.bz2
sparse-4ad6779b132efeff0a68a650393ac2ef1fa601b2.zip
Simplify Makefile using static pattern rules
I find a way to get rid of the macro and $$ in linking executable program. Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--Makefile11
1 files changed, 3 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 571673e..80fce74 100644
--- a/Makefile
+++ b/Makefile
@@ -115,14 +115,9 @@ sparse.pc: sparse.pc.in
compile_EXTRA_DEPS = compile-i386.o
-PROG_LINK_CMD = $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
-
-define BUILD_PROGRAM
-$(prog): $(prog).o $$($(prog)_EXTRA_DEPS) $$(LIBS)
- $$(PROG_LINK_CMD)
-endef
-
-$(foreach prog,$(PROGRAMS),$(eval $(BUILD_PROGRAM)))
+$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
+$(PROGRAMS): % : %.o
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
$(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)