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
<builtin>: recipe for target 'xicursorset' failed
make: *** [xicursorset] Error 1
CFLAGS := -ansi -Wall -pedantic
CFLAGS += -ggdb
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)
clean:
rm -f xicursorset *.o
clean:
rm -f xicursorset *.o