#
# This make file avoids all fancy features to ensure
# better portability between make programs, but it 
# is very clumsy as a result.
#

dbg-flags = 
#sol1-compile = on enigma cc -g -D__sol1__ $(dbg-flags)
sol1-compile = cc -g -D__sol1__ $(dbg-flags)
#sol2-compile = on latsol2 gcc -g $(dbg-flags)
sol2-compile = gcc -g -D__sol2__ $(dbg-flags)

# If you can execute the pwd command with your make program
# put it here.
cwd = ..

client_sol1_objects = 	sol1/gabriel_client.o sol1/hostrec.o \
			sol1/list.o sol1/copyright.o
client_sol2_objects = 	sol2/gabriel_client.o sol2/hostrec.o \
			sol2/list.o sol2/copyright.o


all:
	@echo "Gabriel comes with pre-compiled binaries, so"
	@echo "you do not need to re-make them."
	@echo "Just following the directions in the gabriel.8 man page."
	@echo "Type \"nroff -man gabriel.8\" to display it.
	@echo "  "
	@echo "If you want to make Gabriel from sources, then:"
	@echo "On a solaris 1 system type 'make solaris1'"
	@echo "On a solaris 2 system type 'make solaris2'"

solaris1: sol1 gabriel_client.sol1

gabriel_client.sol1: sol1

solaris2: sol2 gabriel_client.sol2

gabriel_client.sol2: sol2

clean:
	rm -rf sol1
	rm -rf sol2
#	rm -f  gabriel_client.sol1 gabriel_client.sol2
	rm -f  client_error_log client_uname_info syslog_slice
	rm -f *.crontab
	rm -f *~ core

sol1:
	mkdir $@

sol2:
	mkdir $@

sol1/gabriel_client.o: gabriel_client.c
	cd sol1 ; $(sol1-compile) -c $(cwd)/$<

sol2/gabriel_client.o: gabriel_client.c
	cd sol2 ; $(sol2-compile) -c $(cwd)/$<

sol1/hostrec.o: hostrec.c
	cd sol1 ; $(sol1-compile) -c $(cwd)/$<

sol2/hostrec.o: hostrec.c
	cd sol2 ; $(sol2-compile) -c $(cwd)/$<

sol1/list.o: list.c
	cd sol1 ; $(sol1-compile) -c $(cwd)/$<

sol2/list.o: list.c
	cd sol2 ; $(sol2-compile) -c $(cwd)/$<

sol1/copyright.o: copyright.c
	cd sol1 ; $(sol1-compile) -c $(cwd)/$<

sol2/copyright.o: copyright.c
	cd sol2 ; $(sol2-compile) -c $(cwd)/$<

gabriel_client.sol1: $(client_sol1_objects)
	$(sol1-compile) -o gabriel_client.sol1 $(client_sol1_objects)

gabriel_client.sol2: $(client_sol2_objects)
	$(sol2-compile) -o gabriel_client.sol2 $(client_sol2_objects)

