Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (34 sloc) 1.15 KB
CC := gcc
EXTRA_WARNINGS = -Wextra -Wno-unused-parameter
CFLAGS := -ggdb -Wall -std=c99 $(EXTRA_WARNINGS)
override CFLAGS += -D_XOPEN_SOURCE=500
GLIB_CFLAGS := $(shell pkg-config --cflags glib-2.0)
GLIB_LIBS := $(shell pkg-config --libs glib-2.0)
SOUP_CFLAGS := $(shell pkg-config --cflags libsoup-2.4)
SOUP_LIBS := $(shell pkg-config --libs libsoup-2.4)
GTHREAD_CFLAGS := $(shell pkg-config --cflags gthread-2.0)
GTHREAD_LIBS := $(shell pkg-config --libs gthread-2.0)
SCROBBLE_LIBS := $(SOUP_LIBS)
all:
libscrobble.a: scrobble.o
libscrobble.a: CFLAGS := $(CFLAGS) $(GLIB_CFLAGS) $(SOUP_CFLAGS)
test: test.o libscrobble.a
test: CFLAGS := $(CFLAGS) $(GLIB_CFLAGS) $(GTHREAD_CFLAGS)
test: LIBS := $(LIBS) $(GLIB_LIBS) $(GTHREAD_LIBS) $(SCROBBLE_LIBS)
binaries += test
all: libscrobble.a $(binaries)
# pretty print
ifndef V
QUIET_CC = @echo ' CC '$@;
QUIET_LINK = @echo ' LINK '$@;
QUIET_CLEAN = @echo ' CLEAN '$@;
endif
%.a::
$(QUIET_LINK)$(AR) rcs $@ $^
$(binaries):
$(QUIET_LINK)$(CC) $(LDFLAGS) $(LIBS) -o $@ $^
%.o:: %.c
$(QUIET_CC)$(CC) $(CFLAGS) -MMD -o $@ -c $<
clean:
$(QUIET_CLEAN)$(RM) *.o *.d *.a $(binaries)
-include *.d