From: Antonio Ospite Date: Mon, 18 Aug 2014 11:09:17 +0000 (+0200) Subject: Clean up the Makefile, and fix a linking problem X-Git-Url: https://git.ao2.it/xicursorset.git/commitdiff_plain/881a349730a7340e581564e9484d00fb444c16df?ds=sidebyside 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 --- 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