CC = gcc
NAME = helloworld

# path to directory holding the ezdraw.h file
IDIR = ../
# path to the directory holding the libezdraw.a files
LDIR = ../

# loader flags showing where to find the SDL libraries
LDFLAGS = `sdl2-config --libs`

# non SDL libraries to load: ezdraw and math library
LIBS = -lezdraw -lm

# compiler flags for maximum warnings, debugger information,
# and where to find SDL include files
CFLAGS = `sdl2-config --cflags` -g -W -Wall -Wextra -pedantic -O0 -I `sdl2-config --prefix`/include/

OBJS = $(NAME).o

$(NAME): $(NAME).o $(LDIR)libezdraw.a
	$(CC) -o $(NAME) $(NAME).o $(CFLAGS) -L $(LDIR) $(LIBS) $(LDFLAGS)

$(NAME).o: $(NAME).c $(IDIR)ezdraw.h
	$(CC) $(CFLAGS) -I $(IDIR) -c $< -o $@

clean:
	rm -f *.o
	rm -f *~
	rm -f $(NAME)
