[hackers] [farbfeld] Rename TOOL-LDFLAGS to TOOL-LDLIBS, fix order and add explicit .c.o || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Mon, 1 May 2017 20:31:27 +0200 (CEST)

commit 031b208cb24addbe4496eb24da6887b43a54f5e1
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Mon May 1 20:29:25 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon May 1 20:29:25 2017 +0200

    Rename TOOL-LDFLAGS to TOOL-LDLIBS, fix order and add explicit .c.o
    
    The tool-specific flags were LDLIBS and not LDFLAGS, because we specify
    the libraries we want to link in, not flags to the linker itself.
    The order was broken as it didn't allow -Wl,--as-needed or other things
    highly dependent on the order of arguments.
    
    I also wanted to add an explicit .c.o suffix rule. This way, it is
    clearer what is happening in the Makefile and the form of compilation
    output is controllable.

diff --git a/Makefile b/Makefile
index baf2d41..27dc544 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -11,10 +11,10 @@ SCR = 2ff
 MAN1 = 2ff.1 $(BIN:=.1)
 MAN5 = farbfeld.5
 
-png2ff-LDFLAGS = $(PNG-LDFLAGS)
-ff2png-LDFLAGS = $(PNG-LDFLAGS)
-jpg2ff-LDFLAGS = $(JPG-LDFLAGS)
-ff2jpg-LDFLAGS = $(JPG-LDFLAGS)
+png2ff-LDLIBS = $(PNG-LDLIBS)
+ff2png-LDLIBS = $(PNG-LDLIBS)
+jpg2ff-LDLIBS = $(JPG-LDLIBS)
+ff2jpg-LDLIBS = $(JPG-LDLIBS)
 
 all: $(BIN)
 
_AT_@ -23,7 +23,10 @@ $(BIN): $(REQ:=.o)
 $(BIN:=.o): config.mk $(HDR) $(REQ:=.h)
 
 .o:
- $(CC) -o $_AT_ $< $(REQ:=.o) $($*-LDFLAGS) $(LDFLAGS)
+ $(CC) -o $_AT_ $(LDFLAGS) $< $(REQ:=.o) $($*-LDLIBS)
+
+.c.o:
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
 
 clean:
         rm -f $(BIN) $(BIN:=.o) $(REQ:=.o)
diff --git a/config.mk b/config.mk
index 194ab86..67d5448 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -11,8 +11,8 @@ MANPREFIX = ${PREFIX}/man
 CPPFLAGS = -D_DEFAULT_SOURCE
 CFLAGS = -std=c99 -pedantic -Wall -Wextra -Os
 LDFLAGS = -s
-PNG-LDFLAGS = -lpng
-JPG-LDFLAGS = -ljpeg
+PNG-LDLIBS = -lpng
+JPG-LDLIBS = -ljpeg
 
 # compiler and linker
 CC = cc
Received on Mon May 01 2017 - 20:31:27 CEST

This archive was generated by hypermail 2.3.0 : Mon May 01 2017 - 20:36:17 CEST