# Edit this file to define constants and custom build targets.
# Please refer to the makemake documentation for more information.

# Useful directories

MYCODEDIR := ..
SQLINCLUDE := /usr/include/mysql
SQLLIB := /usr/lib/mysql

# Directories to search for header files

SEARCHDIRS := -I- -I${MYCODEDIR}/common -I${MYCODEDIR}/angel -I${MYCODEDIR}/sql -I${SQLINCLUDE} 

# makemake variables

LINKER       := g++
DEPENDFLAGS  := -g -Wall -Werror -ggdb3 ${SEARCHDIRS}
TOUCHHEADERS := ${MYCODEDIR}/*.h

# make variables

CC        := g++
CXX       := g++
CCC       := g++
CPPFLAGS   = ${DEPENDFLAGS}
LOADLIBES := -lmysqlclient
LDFLAGS   := -L${SQLLIB}


# This is what makemake added


# ../bin/aut_mod

../bin/aut_mod : ../common/exception.o ../common/strings.o ../sql/sqltypes.o ./aut_mod.o
	${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}


# ../bin/aut_canc

../bin/aut_canc : ../common/exception.o ../common/strings.o ../sql/sqltypes.o ./aut_canc.o
	${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}


# target for making everything

.PHONY : all
all: ../bin/aut_mod ../bin/aut_canc


# target for removing all object files

.PHONY : tidy
tidy::
	@${RM} core ./aut_canc.o ./aut_mod.o ../common/exception.o ../sql/sqltypes.o ../common/strings.o

# target for removing all object files

.PHONY : clean
clean:: tidy
	@${RM} ../bin/aut_mod ../bin/aut_canc

# list of all source files

MM_ALL_SOURCES := ./aut_canc.cc ./aut_mod.cc ../common/exception.cc ../sql/sqltypes.cc ../common/strings.cc


# target for checking a source file

CHECKSYNTAXFILE := ${basename ${filter %${CHECKSTRING}, ${MM_ALL_SOURCES}}}

.PHONY : checksyntax
checksyntax:
  ifneq (${CHECKSYNTAXFILE},)
	@${MAKE} ${addsuffix .o, ${CHECKSYNTAXFILE}}
  else
	@echo No target to make ${CHECKSTRING}
  endif


# target for touching appropriate source files

.PHONY : touch
touch:
	@echo
	@echo Please ignore \"file arguments missing\" errors
	@echo
	@echo   `grep -l ${TOUCHSTRING} ${MM_ALL_SOURCES}`
	@-touch `grep -l ${TOUCHSTRING} ${MM_ALL_SOURCES}`
	@echo
	@echo   `grep -l ${TOUCHSTRING} ${TOUCHHEADERS}`
	@-touch `grep -l ${TOUCHSTRING} ${TOUCHHEADERS}`


# target for calculating dependencies

.PHONY : jdepend
jdepend:
	@makemake -depend Makefile -- ${DEPENDFLAGS} -- ./aut_canc.cc ./aut_canc.o ./aut_mod.cc ./aut_mod.o ../common/exception.cc ../common/exception.o ../sql/sqltypes.cc ../sql/sqltypes.o ../common/strings.cc ../common/strings.o


# DO NOT DELETE THIS LINE -- makemake depends on it.

./aut_canc.o: ../common/exception.h ../common/strings.h ../sql/sqltypes.h /usr/include/mysql/mysql.h /usr/include/stdlib.h /usr/include/string.h

./aut_mod.o: ../common/exception.h ../common/strings.h ../sql/sqltypes.h /usr/include/mysql/mysql.h /usr/include/stdlib.h /usr/include/string.h

../common/exception.o: ../common/exception.h ../common/strings.h /usr/include/string.h

../sql/sqltypes.o: ../common/exception.h ../common/strings.h ../sql/sqltypes.h /usr/include/mysql/mysql.h /usr/include/stdio.h /usr/include/string.h

../common/strings.o: ../common/exception.h ../common/strings.h /usr/include/errno.h /usr/include/stdio.h /usr/include/stdlib.h /usr/include/string.h

