CC ?= gcc

# prefix for installation and search path (like icons)
PREFIX = /usr/local/

# for normal desktop GTK+
CCFLAGS = -Wall -O2 -g

SQLITECFLAGS = `pkg-config --cflags sqlite3`
GTKCFLAGS = `pkg-config --cflags gtk+-2.0`

CFLAGS = $(CCFLAGS) $(SQLITECFLAGS) $(GTKCFLAGS)

SQLITELDFLAGS = `pkg-config --libs sqlite3`
GTKLDFLAGS = `pkg-config --libs gtk+-2.0`

# no need to change anything below this line
# ------------------------------------------

.SUFFIXES: .d .c

CFLAGS += -MD -DPREFIX=\"$(PREFIX)\" $(OPTIONS)
LDFLAGS = $(CLDFLAGS) $(SQLITELDFLAGS)

RDS_MEMBERS = rds bitstream tmc rds_test
SOURCES = $(patsubst %,%.c,$(RDS_MEMBERS))
OBJS = $(patsubst %,%.o,$(RDS_MEMBERS))
DEPS = $(patsubst %,%.d,$(RDS_MEMBERS))

UR_MEMBERS = rds bitstream tmc uberradio
UR_SOURCES = $(patsubst %,%.c,$(UR_MEMBERS))
UR_OBJS = $(patsubst %,%.o,$(UR_MEMBERS))
UR_DEPS = $(patsubst %,%.d,$(UR_MEMBERS))

all: rds_test

rds_test: $(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS)

uberradio: $(UR_OBJS)
	$(CC) -o $@ $^ $(LDFLAGS) $(GTKLDFLAGS)

clean:
	rm -f *.o *.d rdsread rds_test uberradio

-include $(DEPS)
