#Zlog makefile

#File definitions
SRCS = main.c display.c game.c action.c
HDRS = $(SRCS:.c=.h) objects.h all_inc.h
OBJS = $(SRCS:.c=.o)

#Some useful definitions
CC = gcc
CFLAGS = -W -Wall -O3 -pedantic -std=c99
EXE = game




#Default prsentation of the makefile
default : 
	@echo Please, choose either a lin_xxx or  win_xxx target.
	@echo Eligible targets are : 
	@echo linux and win make the game
	@echo lin_prof and win_prof make the profiled game
	@echo lin_dbg and win_dbg make the debug game
	@echo lin_clean and win_clean...clean the source tree
	


#Main targets : linux and win

linux : $(OBJS) $(HDRS)
	$(CC) $(CFLAGS) $(OBJS) -o $(EXE) `allegro-config --libs`
	
win : windows

windows : $(OBJS)
	$(CC) $(CFLAGS) $^ -o $(EXE).exe -lalleg
	

%.o: %.c
	$(CC) -o $@ -c $< $(CFLAGS)


.PHONY: clean

clean:
	rm *.o
	
lin_dbg :
	$(CC) -W -Wall -g3 -pedantic -std=c99 $(SRCS) -o $(EXE) `allegro-config --libs debug`
	

lin_prof :
	$(CC) -W -Wall -O3 -pedantic -std=c99 -pg $(SRCS) -o $(MZLOG) `allegro-config --libs profile`
