#
# Makefile:
#	For the Pibrella code
#	Copyright (c) 2014 Gordon Henderson
###############################################################################

#DEBUG	= -g -O0
DEBUG	= -O2
CC	= gcc
CFLAGS	= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe

LIBS    = -lwiringPi -lm

SRC	=	tune.c ladder.c stepper.c step1.c wire.c

# May not need to  alter anything below this line
###############################################################################

OBJ	=	$(SRC:.c=.o)

all:		tune ladder stepper step1 wire

tune:	tune.o
	@echo [Link]
	@$(CC) -o $@ tune.o $(LDFLAGS) $(LIBS)

ladder:	ladder.o
	@echo [Link]
	@$(CC) -o $@ ladder.o $(LDFLAGS) $(LIBS)

stepper:	stepper.o
	@echo [Link]
	@$(CC) -o $@ stepper.o $(LDFLAGS) $(LIBS)

step1:	step1.o
	@echo [Link]
	@$(CC) -o $@ step1.o $(LDFLAGS) $(LIBS)

wire:	wire.o
	@echo [Link]
	@$(CC) -o $@ wire.o $(LDFLAGS) $(LIBS)

.c.o:
	@echo [Compile] $<
	@$(CC) -c $(CFLAGS) $< -o $@

.PHONEY:	clean
clean:
	rm -f $(OBJ) wire tune ladder stepper step1 *~ core tags *.bak

.PHONEY:	tags
tags:	$(SRC)
	@echo [ctags]
	@ctags $(SRC)

.PHONEY:	depend
depend:
	makedepend -Y $(SRC)

# DO NOT DELETE

tune.o: pibrella.h
ladder.o: pibrella.h
stepper.o: pibrella.h
step1.o: pibrella.h
wire.o: pibrella.h
