Skip to contentSkip to conversation

Simplify building of programs

PATCH In review Jonas Fonseca 1 participant 2 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Simplify building of programs

Don't list libgit.a twice when compiling programs and make them depend on the .c files so .o files are not left behind.

Makefile (mode:100644) renamed from Makefile (mode:100644 sha1:e26b7c3695bf7ee88a75dcb6fd1953ce8b33c748) +2 -3
@@ -49,8 +49,7 @@
 LIB_H=cache.h object.h
 
 
-LIBS = $(LIB_FILE)
-LIBS += -lz
+LIBS = -lz
 
 ifdef MOZILLA_SHA1
 	SHA1_HEADER="mozilla-sha1/sha1.h"
@@ -70,7 +69,7 @@
 
 all: $(PROG) $(GEN_SCRIPT)
 
-$(PROG):%: %.o $(LIB_FILE)
+$(PROG):%: %.c $(LIB_FILE)
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
 $(LIB_FILE): $(LIB_OBJS)
Signature · 1 line
Jonas Fonseca
#1 lore raw

[ Sorry, newbie in action. Last patch was for cogito, here it is the for git in case it matters. ]

Do not first build .o files when building programs.

Makefile (mode:100644) renamed from Makefile (mode:100644 sha1:57e70239503466fb3a77f1f2618ee64377e8e04b) +1 -1
@@ -50,7 +50,7 @@
 
 init-db: init-db.o
 
-%: %.o $(LIB_FILE)
+%: %.c $(LIB_FILE)
 	$(CC) $(CFLAGS) -o $@ $< $(LIBS)
 
 blob.o: $(LIB_H)
Signature · 1 line
Jonas Fonseca