#
# Makefile for cthugha-L 
# source directory
#
##############################################################################
# You should not need to change anything in this file
#
# Use the file ../configure to set your preferences.
##############################################################################

include ../configure

#
# source-files for the different versions of cthugha.
#
SRC 	= cthugha-L.c display.c sound.c action.c options.c translate.c       \
	  sound_tables.c display_palettes.c information.c sound_waves.c      \
	  keys.c action_flames.c display_pcx.c cd_player.c options_ini.c     \
	  net_sound.c cthugha.c options_dialog.c info_title_usage.c server.c

X11_SRC = cthugha-X11.c x11_display.c sound.c action.c x11_options.c	     \
	  translate.c sound_tables.c x11_disp_pal.c information.c            \
	  sound_waves.c						             \
	  x11_keys.c action_flames.c display_pcx.c cd_player.c x11_opt_ini.c \
	  net_sound.c cthugha.c options_dialog.c info_title_usage.c server.c

SRV_SRC = cthugha-server.c srv_options.c srv_cd_player.c srv_options_ini.c   \
	  srv_sound.c info_title_usage.c keys.c server.c

SS_SRC  = cthugha-saver.c ss_display.c sound.c action.c ss_options.c         \
	  translate.c sound_tables.c ss_disp_pal.c info_title_usage.c        \
          sound_waves.c  action_flames.c display_pcx.c		             \
	  ss_cd_player.c x11_opt_ini.c net_sound.c ss_cthugha.c 


OBJ	= $(SRC:.c=.o)
X11_OBJ = $(X11_SRC:.c=.o)
SRV_OBJ = $(SRV_SRC:.c=.o)
SS_OBJ  = $(SS_SRC:.c=.o) 

ALL_SRC = $(sort $(SRC) $(X11_SRC) $(SRV_SRC) $(SS_SRC))

all: .depend ../cthugha $(MKTAB) ../cthugha-server	           \
	../xcthugha-saver ../xcthugha  ../tabheader ../tabinfo 

#
# console version
#
../cthugha: $(OBJ)
	$(CC) -o ../cthugha $(OBJ) $(LDFLAGS) $(LIB_CTHUGHA)

#
# X11-version
#
../xcthugha: $(X11_OBJ)
	$(CC) -o ../xcthugha $(X11_OBJ) $(LDFLAGS) $(LIB_XCTHUGHA)

#
# sound server
#
../cthugha-server: $(SRV_OBJ)
	$(CC) -o ../cthugha-server $(SRV_OBJ) $(LDFLAGS) $(LIB_CTHUGHA_SERVER)

#
# X11 screen saver
#
../xcthugha-saver: $(SS_OBJ)
	$(CC) -o ../xcthugha-saver $(SS_OBJ) $(LDFLAGS) $(LIB_XCTHUGHA_SAVER)


#
# utilities for translation files
#
../tabheader: tabheader.c cth_buffer.h translate.h
	$(CC) tabheader.c $(LDFLAGS) -o ../tabheader
../tabinfo: tabinfo.c cth_buffer.h translate.h
	$(CC) tabinfo.c $(LDFLAGS) -o ../tabinfo

#
# remove some junk
#
.PHONY: clean
clean:
	rm -f *.o *.s .depend *~

.depend: 
	$(CC) -MM -I $(NC_INC) -I $(LIBSX_INC) $(ALL_SRC) > .depend

 
ifeq (.depend,$(wildcard .depend))
   include .depend
endif


