CC = gcc -g -ggdb $(PROF)
CPP = g++ -g -ggdb $(PROF)
CFLAGS = -Wall -O2 -Iinclude $(EXTRA)
EXTRA = -I/usr/local/include
LDFLAGS = -L/usr/lib -L/usr/local/lib
RM = rm -f
FIND = find
MAKE = make
INDENT = indent
ERASER = eraser
ifeq ("$(PROFILER)", "linux")
PROF = -fprofile-arcs -ftest-coverage -pg
endif
TARGET = bluetooth
TARGET += bluetooth-client
.SUFFIXES: .c .cc .asm
.c.o:
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) -o $@ $<
all: $(TARGET)
bluetooth: bluetooth.o
@echo Linking $< ...
@$(CC) $< $(LDFLAGS) -lbluetooth -o $@
bluetooth-client: bluetooth-client.o
@echo Linking $< ...
@$(CC) $< $(LDFLAGS) -lbluetooth -o $@
.PHONY: beauty clean uninstall
clean:
ifdef FIND
$(FIND) . -name '*~' -exec $(RM) {} \;
$(FIND) . -name '*.[oa]' -exec $(RM) {} \;
$(FIND) . -name '*.gcov' -exec $(RM) {} \;
$(FIND) . -name '*.gcda' -exec $(RM) {} \;
$(FIND) . -name '*.gcno' -exec $(RM) {} \;
$(FIND) . -name 'gmon.out' -exec $(RM) {} \;
endif
$(RM) $(TARGET)
beauty:
ifdef FIND
$(FIND) . -name '*.[ch]' -exec $(INDENT) {} \;
$(FIND) . -name '*.[ch]' -exec $(ERASER) {} \;
$(FIND) . -name '*.java' -exec $(ERASER) {} \;
$(FIND) . -name 'Makefile*' -exec $(ERASER) {} \;
endif
@$(MAKE) clean