CC := gcc CFLAGS := -O2 -ggdb -Wall -Wextra -Wno-unused-parameter -ansi -std=c99 LDFLAGS := -Wl,--no-undefined override CFLAGS += -D_GNU_SOURCE GIO_CFLAGS := $(shell pkg-config --cflags gio-2.0) GIO_LIBS := -lgio-2.0 -lgobject-2.0 -lglib-2.0 all: # pretty print ifndef V QUIET_CC = @echo ' CC '$@; QUIET_LINK = @echo ' LINK '$@; QUIET_CLEAN = @echo ' CLEAN '$@; endif test: test.o pn_core.o pn_session.o pn_node.o \ pn_trans.o pn_cmd_node.o pn_ns.o \ pn_log.o pn_printf.o test: override CFLAGS += $(GIO_CFLAGS) test: override LIBS += $(GIO_LIBS) bins += test all: $(bins) $(bins): $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) %.so:: $(QUIET_LINK)$(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) clean: $(QUIET_CLEAN)$(RM) $(bins) *.o *.d %.o:: %.c $(QUIET_CC)$(CC) $(CFLAGS) -MMD -o $@ -c $< -include *.d