# Define the C compiler and extend the flags used for gcc to
# switch on all warnings plus search the Src directory for
# the include file kernel.h
CC = gcc
CCFLAGS = $(CFLAGS) -Wall -Wextra -Wpedantic

CCFLAGS := $(CCFLAGS) -I Src

# Define the compile rule for C
%.o: %.c
	$(CC) $(CCFLAGS) -o $@ -c $<

# Where to look for the source files
VPATH  = Drivers Src

executables = check deltagammainc Gfunc

all: $(executables)

Gfunc: Gfunc.o kernel.o -lm
	$(CC) $(CCFLAGS) -o $@ $^

deltagammainc: deltagammainc.o kernel.o -lm
	$(CC) $(CCFLAGS)  -o $@ $^

check: check.o kernel.o -lm
	$(CC) $(CCFLAGS) -o $@ $^

kernel.o: kernel.h

kernel.h:

Gfunc.o: kernel.o

datagammainc.o: kernel.o

check.o: kernel.o

.PHONY: clean
clean: 
	# remove all files generated by the compiler
	# these are compiler dependent
	rm -f *.o 
	# remove all executables
	rm -f $(executables)
