From da65db75348d4c8e9c3dc1f45654ff7eb6e9a10f Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sun, 21 Aug 2016 09:49:44 -0400 Subject: [PATCH] build: Compile each source file separately. --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4e1c712..5dc1bda 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ CUPS_DATA_DIR ?= $(PREFIX)`cups-config --datadir` # Tools CC ?= $(CROSS_COMPILE)gcc +LD ?= $(CROSS_COMPILE)gcc CPPCHECK ?= cppcheck MKDIR ?= mkdir INSTALL ?= install @@ -40,8 +41,11 @@ SOURCES = backend_common.c $(addsuffix .c,$(addprefix backend_,$(BACKENDS))) all: $(EXEC_NAME) $(BACKENDS) -$(EXEC_NAME): $(SOURCES) $(DEPS) - $(CC) -o $@ $(SOURCES) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) +%.o: %.c $(DEPS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +$(EXEC_NAME): $(SOURCES:.c=.o) $(DEPS) + $(CC) -o $@ $(SOURCES:.c=.o) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(BACKENDS): $(EXEC_NAME) $(LN) -sf $(EXEC_NAME) $@