From 881a349730a7340e581564e9484d00fb444c16df Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 18 Aug 2014 13:09:17 +0200 Subject: [PATCH] Clean up the Makefile, and fix a linking problem Use the implicit rule for single source file programs. Specify CFLAGS and LDLIBS appropriately. Also link against libX11 explicitly in order to fix this linking error: cc -ansi -Wall -pedantic -ggdb xicursorset.c -lXi -lXcursor -o xicursorset /usr/bin/ld: /tmp/cc6cA5Ex.o: undefined reference to symbol 'XFlush' //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status : recipe for target 'xicursorset' failed make: *** [xicursorset] Error 1 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3fff7f7..407d4cc 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CFLAGS := -ansi -Wall -pedantic CFLAGS += -ggdb +CFLAGS += $(shell pkg-config --cflags x11 xi xcursor) -LDFLAGS := $(shell pkg-config --cflags --libs xi xcursor) +LDLIBS := $(shell pkg-config --libs x11 xi xcursor) -xicursorset: xicursorset.c - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) +all: xicursorset clean: rm -f xicursorset *.o -- 2.1.4