CC = gcc
###############################################################################################
# Use the following symbols for normal operation (using gpio daemon library)
LDFLAGS = -lpthread -lpigpiod_if2 -lrt -lm
CFLAGS = -O3 -Wall -Wextra -std=gnu11 -DUSE_GPIO_DAEMON

# Use the following symbols for normal operation (using direct calling gpio library)
#LDFLAGS = -lpthread -lpigpio -lrt -lm
#CFLAGS = -O3 -Wall -Wextra -std=gnu11

# Use the following when debugging to compile in backtrace capabilities
#LDFLAGS = -lpthread -lpigpiod_if2 -lrt -lm -rdynamic
#CFLAGS = -Og -g -Wall -Wextra -funwind-tables -DDEBUG -std=gnu11 -DUSE_GPIO_DAEMON
###############################################################################################
###############################################################################################
all: simple_pipes test_bluetooth
###############################################################################################
###############################################################################################
simple_pipes.o : simple_pipes.c
	-$(CC) -c simple_pipes.c -o $@ $(CFLAGS)

test_bluetooth.o : test_bluetooth.c
	-$(CC) -c test_bluetooth.c -o $@ $(CFLAGS)
###############################################################################################
###############################################################################################
simple_pipes : simple_pipes.o
	-$(CC) simple_pipes.o -o $@ $(LDFLAGS)
	-chmod 755 simple_pipes

test_bluetooth : test_bluetooth.o
	-$(CC) test_bluetooth.o -o $@ $(LDFLAGS)
	-chmod 755 test_bluetooth
###############################################################################################
###############################################################################################
clean:
	-rm -f *.o *~ simple_pipes test_bluetooth
