#
# Makefile
#
# Version 2.0 : Frederick Roeber : 3 June 1992
#
# This is the makefile for the rlog type manager
#
#
# ***  WARNING  ***
#
# Usually you will not want to re-make the rlog type manager.
# This product does not depend on anything beyond the Apollo
# Domain/OS system, so it will rarely need remaking.  Usually
# the rlog type will be put on a new node by installing it
# from another node with the "inty" command.  Recompiling the
# type manager and assigning the rlog type a new uid will 
# make any existing rlog files unreadable.
#
# To rebuild from scratch, give the following commands:
#
#       dlty rlog           (delete the existing rlog type)
#       rm /sys/mgrs/rlog   (remove the type manager -- requires priv.)
#       crty rlog           (create a new rlog type)
#       crtyobj rlog        (or "make rlog_uid.bin")
#       make rlog           (makes the type manager)
#       intm rlog           (installs it.  Requires priv.)
#
#       make mkrlog.a       (make the "make rlog" call library)
#       make make_rlog      (make the "make rlog" command)
#
# To copy the type manager from another node:
#
#       inty rlog //node
#
#   Where //node is the name of a node with the type already installed.
#

SHELL = /bin/sh
CFLAGS = -O -W0,-pic -r -a -A systype,any -A runtype,any 
SOURCES = \
          close.c               \
          equal.c               \
          export.c              \
          force_write_file.c    \
          get.c                 \
          get_ec.c              \
          import.c              \
          initialize.c          \
          inq_byte_pos.c        \
          inq_conn_flags.c      \
          inq_file_attr.c       \
          inq_full_key.c        \
          inq_mgr_flags.c       \
          inq_obj_flags.c       \
          inq_rec_type.c        \
          inq_short_key.c       \
          open.c                \
          post_fork.c           \
          pre_fork.c            \
          put.c                 \
          putp.c                \
          seek.c                \
          seek_full_key.c       \
          seek_short_key.c      \
          seek_to_bof.c         \
          seek_to_eof.c         \
          set_conn_flag.c       \
          set_obj_flag.c        \
          set_rec_type.c        \
          truncate.c            \
          rlog.c

all: make_rlog rlog_size

clean:
	rm -f *.bak *.o *.a make_rlog rlog_size

tidy:
	rm *.bak

depend:

install_includes:
	cp mkrlog.h $(SL_INCLUDE)

install:
	cp mkrlog.a $(SL_LIB)
	cp make_rlog $(SL_BIN)
	cp rlog_size $(SL_BIN)


$(SOURCES) : rlog.h prototypes.h

rlog: rlog_uid.bin $(SOURCES:.c=.o)
	ld -r -a -o rlog -e 'ios_$$initialize' -A systype,any -A runtype,any rlog_uid.bin $(SOURCES:.c=.o) /sys/traits/io_traits.3

mkrlog.o: mkrlog.c
	$(CC) -g -O -A systype,any -A runtype,any -c mkrlog.c

make_rlog: make_rlog.c mkrlog.a
	$(CC) -g -O -A systype,any -A runtype,any make_rlog.c mkrlog.a -o make_rlog

rlog_size: rlog_size.c
	$(CC) -g -O -A systype,any -A runtype,any rlog_size.c mkrlog.a -o rlog_size

mkrlog.a: mkrlog.o rlog_uid.bin
	ar -ru mkrlog.a mkrlog.o rlog_uid.bin

rlog_uid.bin:
	crtyobj rlog

type: rlog_uid.bin
	crty rlog

install_manager: rlog
	intm rlog

mkrlog.c: rlog.h mkrlog.h

make_rlog.c: mkrlog.h

test_rlog: $(SOURCES:.c=.o)
	ld -o test_rlog /com/ios_test $(SOURCES:.c=.o) rlog_uid.bin /sys/traits/io_traits.3

