C_MOD = server build cleanup compare decnet format get init mailcount \
	parse readport lookup_indexed pseudo rtpad secure telnet where_queued

MACRO_MOD = devices terminal epid_to_ipid

# if you are running a version of VMS prior to V5.0, then
# make sure the following line isn't commented:
#CC =
# and make sure that the following line is commented:
CC = /define\="VMS5\=1"

LINK =

all : status.hlp init status.exe server.exe manage.exe

status.hlp : $*.rnh
	runoff $*.rnh

init :
	\@init

status.exe : status.obj window.obj init_cli.obj status_cld.obj
	link$(LINK) $?, c/option

server.exe : globaldef.obj $(C_MOD).obj $(MACRO_MOD).obj
	link$(LINK) $(C_MOD), globaldef, $(MACRO_MOD), c/option, \
		sys\$system:sys.stb/select

manage.exe : manage.obj
	link$(LINK) $?, c/option

.c.obj :
	cc$(CC) $*

.mar.obj :
	macro $*

.cld.obj :
	set command/object $*

status.obj : $*.c globals.h

manage.obj : $*.c config.h

$(MACRO_MOD).obj : $*.mar

globaldef.obj : $*.c globals.h server.h keywords.h jpicodes.h

# format and secure need to be compiled if the config file is changed
format.obj secure.obj : $*.c config.h

$(C_MOD).obj : $*.c globals.h server.h jpicodes.h

# keywords.h is built by order_keywords, using keywords.dat
keywords.h : keywords.dat order_keywords.exe
	run order_keywords

# jpicodes.h is built by the program jpicodes
jpicodes.h : jpicodes.exe
	run jpicodes

# order_keywords reads keywords.dat and creates keywords.h
order_keywords.exe : order_keywords.obj
	link/notrace$(LINK) order_keywords,c/option

order_keywords.obj : order_keywords.c

jpicodes.exe : jpicodes.obj
	link/notrace$(LINK) jpicodes,c/option

jpicodes.obj : jpicodes.c
