Commit 4b28f6ac422e9ca8b2b3e75c59e663fe4e13bae1

Werner Lemberg 2016-09-04T19:05:45

[ftrandom] Improve Makefile. It now supports both a normal build (`./configure && make') and a development build (`make devel'). * src/tools/ftrandom/Makefile (VPATH): Set it so that `libfreetype.a' gets searched in both `objs' (for the development build) and `objs/.libs' (for a normal build which uses libtool). (LIBS): Add missing libraries. (ftrandom.o): New rule. (ftrandom): Use automatic variables.

diff --git a/ChangeLog b/ChangeLog
index 4bee150..355a034 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2016-09-04  Werner Lemberg  <wl@gnu.org>
+
+	[ftrandom] Improve Makefile.
+
+	It now supports both a normal build (`./configure && make') and a
+	development build (`make devel').
+
+	* src/tools/ftrandom/Makefile (VPATH): Set it so that
+	`libfreetype.a' gets searched in both `objs' (for the development
+	build) and `objs/.libs' (for a normal build which uses libtool).
+	(LIBS): Add missing libraries.
+	(ftrandom.o): New rule.
+	(ftrandom): Use automatic variables.
+
 2016-09-03  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] More fixes for handling of GX deltas.
diff --git a/src/tools/ftrandom/Makefile b/src/tools/ftrandom/Makefile
index 2e61929..61fdf48 100644
--- a/src/tools/ftrandom/Makefile
+++ b/src/tools/ftrandom/Makefile
@@ -5,7 +5,12 @@ TOP_DIR ?= ../../..
 OBJ_DIR ?= $(TOP_DIR)/objs
 
 
-# The setup below is for gcc on a Unix-like platform.
+# The setup below is for gcc on a Unix-like platform,
+# where FreeType has been set up to create a static library
+# (which is the default).
+
+VPATH = $(OBJ_DIR) \
+        $(OBJ_DIR)/.libs
 
 SRC_DIR = $(TOP_DIR)/src/tools/ftrandom
 
@@ -23,13 +28,17 @@ CFLAGS = $(WFLAGS) \
          -g \
          -I $(TOP_DIR)/include
 LIBS = -lm \
-       -L $(OBJ_DIR) \
-       -lfreetype \
-       -lz
+       -lz \
+       -lpng \
+       -lbz2 \
+       -lharfbuzz
 
 all: $(OBJ_DIR)/ftrandom
 
-$(OBJ_DIR)/ftrandom: $(SRC_DIR)/ftrandom.c $(OBJ_DIR)/libfreetype.a
-	$(CC) -o $(OBJ_DIR)/ftrandom $(CFLAGS) $(SRC_DIR)/ftrandom.c $(LIBS)
+$(OBJ_DIR)/ftrandom.o: $(SRC_DIR)/ftrandom.c
+	$(CC) -c -o $@ $(CFLAGS) $<
+
+$(OBJ_DIR)/ftrandom: $(OBJ_DIR)/ftrandom.o libfreetype.a
+	$(CC) -o $(OBJ_DIR)/ftrandom $^ $(LIBS)
 
 # EOF