CC	= gcc
SHELL	= /bin/bash

CFLAGS	= -g -O2 -Wall
LDADD   = -lgtk -lXext -lgdk -lglib -lX11 -lm 

DEPS = gtkspinbutton.d 

.PHONY: clean

all: $(DEPS) testspinbutton

clean:
	rm -f *.d *.o *~ core testspinbutton

testspinbutton: $(DEPS:.d=.o) testspinbutton.c
	$(CC) $(CFLAGS) testspinbutton.c -o testspinbutton $(DEPS:.d=.o) $(LDADD)

-include $(DEPS)

#-----------------------------------------------------------------------------

%.o : %.c
	$(CC) $(INC) $(CFLAGS) -c $< -o $@

%.d : %.c
	@echo "Computing dependencies for $< ..."
	@$(SHELL) -ec '$(CC) -E -MM $(CFLAGS) $< \
	| sed '\''s/\($*\)\.o[ :]*/\1.o\ $@ : /g'\'' > $@'
