ifneq ($(V),1)
        Q := @
endif

INCDIR          = -I /usr/include/SDL
CCFLAGS         = -g -O2 -Wall -W $(INCDIR)
CXXFLAGS        = $(CCFLAGS)
LDFLAGS         = -l asound -l SDL
CC              = gcc $(CCFLAGS)
CXX             = g++ $(CXXFLAGS)
LD              = g++ $(LDFLAGS)

BINS            = sonar
OBJS            = sonar.o

all: $(BINS)

clean:
        $(Q) rm -f *.o $(BINS) $(OBJS)
        @printf "  CLEAN\n";

.c.o:
        @printf "  CC  $(subst $(shell pwd)/,,$(@))\n";
        $(Q) $(CC) -c -o$@ $<

.cpp.o:
        @printf "  CXX $(subst $(shell pwd)/,,$(@))\n";
        $(Q) $(CXX) -c -o$@ $<

sonar: $(OBJS)
        @printf "  LD  $(subst $(shell pwd)/,,$(@))\n";
        $(Q) $(LD) -o$@ $(OBJS)