
#======================================================================
#          See README.First for instructions on compiling.
#======================================================================
# Useful targets:
#
#	make		# Make everything (no install).
#	make install	# Install latest binaries, sounds, maps, etc.
#			# * DOES NOT REMAKE! *
#	make clean	# Remove everything from /lux that didn't come
#                       # in the distribution file.
#	make uninstall	# Remove things that were installed (doesn't
#			# delete highscores).
#=======================================================================

export BASIC_C_FLAGS = -Wall -O2 -m486 -fomit-frame-pointer 

# Prevent myself from accidentally running make in subdirs (they
# need BASIC_C_FLAGS)
export TOP_LEVEL=ok

CXXFLAGS = $(BASIC_C_FLAGS) -I.
CFLAGS = $(CXXFLAGS)

#ifeq (.depend,$(wildcard .depend))
all: gtoolsdir rawkeylib libmisc argvlib luxdir  
#include .depend
#else
#all: dep gtoolsdir rawkeylib libmisc argvlib luxdir
#endif

libmisc:
	make -k -C lib

gtoolsdir:
	make -k -C gtools

rawkeylib:
	make -C rawkey

argvlib:
	make -C argv

luxdir:
	make -C src
	@echo
	@echo 'You may now play LuxMan from this directory,'
	@echo 'or type "make install" to install the proper'
	@echo 'files in /usr/games and /usr/lib/luxman'.
	@echo

#
# Warning! Installs latest binaries only. Doesn't check remake.
#
install: 	luxman luxman-snd
	install -m 755 -d /usr/lib/luxman
	install -m 755 -d /usr/lib/luxman/11k
	install -m 755 -d /usr/lib/luxman/8k
	install -m 755 -d /usr/games
	install -s -m 4755 luxman /usr/games
	install -s -m 755 luxman-snd /usr/games
	install -m 444 ./maps/*.map ./maps/*.font /usr/lib/luxman
	install -m 444 ./11k/*.snd /usr/lib/luxman/11k
	install -m 444 ./8k/*.snd /usr/lib/luxman/8k

uninstall:
	rm -rf /usr/lib/luxman
	rm -f /usr/games/luxman
	rm -f /usr/games/luxman-snd

clean:
	rm -f *~ core
	make -C gtools clean
	make -C rawkey clean
	make -C lib clean
	make -C argv clean
	make -C src clean

dep:
	make -C gtools dep
	make -C lib dep
	make -C src dep

