CC = gcc
# YP: for gprof profiling
#CFLAGS = -O2 -Wall -pg
# YP: for my own profiler/memory profiler
#CFLAGS = -Wall -g -finstrument-functions -DUSE_GLASS -DNATOW_VERSION_STRING=\"$(VERSION)\" -I/home/yperret/include
VERSION = 0.2.10


CFLAGS = -O3 -Wall -g -DUSE_GLASS -DNATOW_VERSION_STRING=\"$(VERSION)\"

OBJS = 2d.o \
       about.o ai.o \
       bird.o \
       camera.o config.o cursor.o \
       display_stack.o draw.o draw_map.o \
       explosion.o \
       file.o \
       game.o game_config.o glut_interface.o \
       image.o input.o \
       keymap.o \
       lakes.o level.o level_list.o light.o \
       main.o map.o map_texture.o munition.o \
       objects.o \
       plasma.o player.o player_config.o player_list.o player_stats.o projectile.o pathfind.o \
       round.o round_config.o \
       satellite.o shade.o smoke.o start.o \
       tank.o tanks.o text.o texture.o tools.o trails.o turn.o \
       update.o \
       vector.o videoc.o \
       world.o

LIBS = -lGL -lglut -lGLU -lm -L/usr/X11R6/lib -lXi -lXmu -lglass
# YP: to compile at my job
LIBS =  -L/usr/lib -lGL -lglut -lGLU \
	 -lm -L/usr/X11R6/lib -lXi -lXmu -L/home/yperret/tmp/lib -lglass

all: $(OBJS)
	$(CC) $(CFLAGS) -o natow $(OBJS) $(LIBS)
# YP: target for my own profiler
#all: $(OBJS)
#	$(CC) $(CFLAGS) -o natow $(OBJS) /home/yperret/funC/fnccheck-1.4/src/lib/.libs/libfnccheck.a $(LIBS)

# Dependancies
2d.o: 2d.c 2d.h world.h image.h text.h cursor.h

about.o: about.c about.h world.h 2d.h update.h input.h cursor.h text.h \
         tools.h display_stack.h glut_interface.h

ai.o: ai.c ai.h world.h game.h round.h turn.h player.h vector.h tools.h map.h \
      text.h pathfind.h player_stats.h

bird.o: bird.c bird.h world.h game.h vector.h text.h tools.h update.h map.h

camera.o: camera.c camera.h world.h vector.h map.h text.h tools.h \
          round.h game.h

config.o: config.c config.h text.h

cursor.o: cursor.c cursor.h world.h tools.h 2d.h display_stack.h

display_stack.o: display_stack.c display_stack.h world.h tools.h shade.h text.h

draw.o: draw.c draw.h world.h text.h draw_map.h 2d.h input.h about.h \
        player.h player_config.h player_list.h \
        projectile.h trails.h explosion.h smoke.h objects.h start.h \
        cursor.h videoc.h shade.h bird.h game.h game_config.h round_config.h \
        keymap.h glut_interface.h display_stack.h

draw_map.o: draw_map.c draw_map.h world.h game.h update.h map.h satellite.h text.h tools.h \

explosion.o: explosion.c explosion.h world.h game.h round.h turn.h \
             text.h vector.h map.h smoke.h \
             player.h map_texture.h tools.h player_stats.h player_list.h light.h

file.o: file.c file.h tools.h

game.o: game.c game.h world.h text.h 2d.h ai.h player.h player_list.h draw.h tank.h tanks.h \
        munition.h satellite.h level.h map.h videoc.h file.h input.h \
        image.h bird.h tools.h update.h cursor.h glut_interface.h \
        display_stack.h light.h

game_config.o: game_config.c game_config.h game.h world.h text.h tools.h 2d.h \
               glut_interface.h display_stack.h texture.h \
               player_list.h level_list.h

glut_interface.o: glut_interface.c glut_interface.h world.h

image.o: image.c image.h text.h tools.h

input.o: input.c input.h world.h tools.h file.h text.h player.h \
         player_config.h player_list.h \
         camera.h projectile.h videoc.h start.h 2d.h ai.h \
         game.h game_config.h round.h round_config.h \
         about.h draw.h config.h keymap.h \
         glut_interface.h display_stack.h

keymap.o: keymap.c keymap.h tools.h file.h text.h config.h 2d.h \
          draw.h display_stack.h glut_interface.h plasma.h

lakes.o: lakes.c lakes.h tools.h

level.o: level.c level.h game.h file.h text.h tools.h map.h \
         texture.h objects.h map_texture.h lakes.h satellite.h \
         glut_interface.h

level_list.o: level_list.c level_list.h text.h tools.h file.h world.h

light.o: light.c light.h text.h vector.h map.h

main.o: main.c main.h world.h tools.h text.h cursor.h glut_interface.h \
        keymap.h config.h videoc.h start.h 2d.h about.h draw_map.h \
        bird.h tanks.h

map.o: map.c map.h world.h vector.h image.h tools.h text.h light.h

map_texture.o: map_texture.c map_texture.h world.h game.h text.h \
               texture.h map.h tools.h

munition.o: munition.c munition.h world.h file.h text.h tools.h

objects.o: objects.c objects.h world.h game.h tools.h map.h text.h file.h

pathfind.o: pathfind.c pathfind.h world.h game.h player.h text.h tools.h

plasma.o: plasma.c plasma.h 2d.h tools.h \

player.o: player.c player.h \
          world.h game.h round.h turn.h \
          text.h vector.h \
          map.h tank.h projectile.h 2d.h draw.h ai.h tools.h \
          display_stack.h glut_interface.h

player_config.o: player_config.c player_config.h \
                 tools.h world.h game.h player.h player_list.h \
                 2d.h glut_interface.h

player_list.o: player_list.c player_list.h text.h tools.h

player_stats.o: player_stats.c player_stats.h world.h text.h tools.h

projectile.o: projectile.c projectile.h world.h game.h vector.h map.h \
              trails.h munition.h explosion.h text.h tools.h \
              light.h

round.o: round.c round.h world.h text.h tools.h camera.h player.h player_list.h objects.h \
         projectile.h trails.h explosion.h smoke.h draw.h 2d.h ai.h \
         map.h bird.h game.h display_stack.h draw_map.h turn.h \
         light.h glut_interface.h

round_config.o: round_config.c round_config.h round.h glut_interface.h \
                display_stack.h 2d.h

satellite.o: satellite.c satellite.h world.h game.h map.h text.h tools.h

shade.o: shade.c shade.h world.h text.h 2d.h display_stack.h \
         glut_interface.h

smoke.o: smoke.c smoke.h world.h game.h text.h vector.h map.h round.h \
         tools.h

start.o: start.c start.h world.h 2d.h image.h update.h input.h \
         cursor.h  text.h round.h game.h draw.h tools.h \
         display_stack.h glut_interface.h plasma.h

tank.o: tank.c tank.h world.h tanks.h map.h projectile.h texture.h \
        vector.h text.h tools.h file.h

tanks.o: tanks.c tanks.h world.h

text.o: text.c text.h

texture.o: texture.c texture.h image.h tools.h text.h

tools.o: tools.c tools.h

trails.o: trails.c trails.h game.h tools.h vector.h

turn.o: turn.c turn.h text.h game.h round.h player.h player_list.h camera.h

update.o: update.c update.h world.h game.h camera.h round.h projectile.h \
          trails.h player.h objects.h ai.h explosion.h satellite.h \
          shade.h glut_interface.h display_stack.h

vector.o: vector.c vector.h

videoc.o: videoc.c videoc.h world.h game.h plasma.h

world.o: world.c world.h game.h vector.h map.h camera.h text.h draw.h \
         tools.h keymap.h display_stack.h \
         draw.h input.h update.h cursor.h tank.h munition.h satellite.h

# Clean out files so able to be recompiled from scratch
clean:
	rm -f *~ *.o natow core && rm -rf .xvpics/
