### HeadHunters v2.6 Makefile ###
CC=gcc

BASE_CFLAGS=-Dstricmp=strcasecmp -D_strnicmp=strncasecmp \
	-DARCH=\"$(ARCH)\" -D_HH_
CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
	-fomit-frame-pointer -fexpensive-optimizations

LDFLAGS=-ldl -lm

SHLIBEXT=so

SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared

DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<

.c.o:
	$(DO_SHLIB_CC)

GAME_OBJS_GC = \
	gc_action.o gc_chase.o gc_cmd.o gc_config.o gc_connect.o \
	gc_creep.o gc_fixed.o gc_frame.o gc_free.o gc_id.o \
	gc_main.o gc_menu.o gc_net.o gc_ticker.o gc_utils.o

GAME_OBJS_HH = \
	g_ai.o g_chase.o g_cmds.o g_combat.o g_func.o g_items.o \
	g_main.o g_misc.o g_monster.o g_phys.o g_save.o g_spawn.o \
	g_svcmds.o g_target.o g_trigger.o g_utils.o g_weapon.o \
	m_move.o p_client.o p_hud.o p_trail.o p_view.o p_weapon.o \
	q_shared.o \
	hh_altar.o hh_client.o hh_ctf.o hh_deathmsg.o hh_edit.o hh_global.o \
	hh_head.o hh_ini.o hh_levsel.o hh_teamplay.o hh_vote.o \
	gslog.o stdlog.o

game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS_GC)
	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS_GC)


hh$(ARCH).$(SHLIBEXT) : $(GAME_OBJS_HH)
	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS_HH)

headhunters : game$(ARCH).$(SHLIBEXT) hh$(ARCH).$(SHLIBEXT)

#############################################################################
# MISC
#############################################################################

clean:
	-rm -f $(GAME_OBJS_HH) $(GAME_OBJS_GC)

depend:
	gcc -MM -DARCH=\"$(ARCH)\" -D_HH_ \
	$(GAME_OBJS_HH:.o=.c) $(GAME_OBJS_GC:.o=.c)

#############################################################################
# DEPENDANCIES
#############################################################################

### GameCam

gc_action.o: gc_action.c gamecam.h
gc_chase.o: gc_chase.c gamecam.h
gc_cmd.o: gc_cmd.c gamecam.h
gc_config.o: gc_config.c gamecam.h
gc_connect.o: gc_connect.c gamecam.h
gc_creep.o: gc_creep.c gamecam.h
gc_fixed.o: gc_fixed.c gamecam.h
gc_frame.o: gc_frame.c gamecam.h
gc_free.o: gc_free.c gamecam.h
gc_id.o: gc_id.c gamecam.h
gc_main.o: gc_main.c gamecam.h
gc_menu.o: gc_menu.c gamecam.h
gc_net.o: gc_net.c gamecam.h
gc_ticker.o: gc_ticker.c gamecam.h
gc_utils.o: gc_utils.c gamecam.h

### HeadHunters

g_ai.o: g_ai.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_chase.o: g_chase.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_cmds.o: g_cmds.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_combat.o: g_combat.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_func.o: g_func.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_items.o: g_items.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_main.o: g_main.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_misc.o: g_misc.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_monster.o: g_monster.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_phys.o: g_phys.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_save.o: g_save.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
g_spawn.o: g_spawn.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_svcmds.o: g_svcmds.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_target.o: g_target.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_trigger.o: g_trigger.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_utils.o: g_utils.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
g_weapon.o: g_weapon.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
m_move.o: m_move.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
p_client.o: p_client.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
p_hud.o: p_hud.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
p_trail.o: p_trail.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
p_view.o: p_view.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
p_weapon.o: p_weapon.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
q_shared.o: q_shared.c q_shared.h
hh_altar.o: hh_altar.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_client.o: hh_client.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_ctf.o: hh_ctf.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
hh_deathmsg.o: hh_deathmsg.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_edit.o: hh_edit.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_global.o: hh_global.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_head.o: hh_head.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_ini.o: hh_ini.c hh_shared.h g_local.h q_shared.h game.h m_player.h \
 stdlog.h gslog.h
hh_levsel.o: hh_levsel.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_teamplay.o: hh_teamplay.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
hh_vote.o: hh_vote.c hh_shared.h g_local.h q_shared.h game.h \
 m_player.h stdlog.h gslog.h
stdlog.o: stdlog.c g_local.h q_shared.h game.h stdlog.h
gslog.o: gslog.c g_local.h q_shared.h game.h stdlog.h
