IMP = $(HOME)/imp
U_LIB = $(IMP)/lib/.oU
USER = $(IMP)/user
DRIVER = $(IMP)/driver
BISYNC = $(IMP)/bisync

I_IMP = $(IMP)/include
I_USER = $(USER)

CFLAGS = $(OPTIONS) -I$(I_IMP) -I$(BISYNC) $(DFLAGS)
CC = $(C) -c $(CFLAGS)

UO_LIB = $(U_LIB)/msg.o\
	$(U_LIB)/mem.o

#
# the user files are needed for UNIX
# versions only
#
O_USER = $(USER)/.unix/imc.o\
		$(USER)/.unix/ram.o\
		$(USER)/.unix/init.o

O_BISYNC =\
	bsc.o\
	bsc_req.o\
	bsc_ascii.o\
	bsc_tx.o\
	bsc_rx.o

U_OFILES = $(O_BISYNC) $(UO_LIB) $(O_USER)


bisync:		BISYNC.o

BISYNC.o:	$(O_BISYNC)
		$(LD) -o BISYNC.o -r $(O_BISYNC)

Ubisync:	$(U_OFILES)
		cc -o Ubisync $(OPTIONS) $(U_OFILES)

bsc.o:\
	$(I_IMP)/gct.h\
	$(I_IMP)/fatal.h\
	$(I_IMP)/modules.h\
	$(I_IMP)/msg.h\
	$(I_IMP)/types.h\
	$(I_IMP)/timer.h\
	$(I_IMP)/status.h\
	$(I_IMP)/mng.h\
	$(DRIVER)/mtypes.h\
	$(BISYNC)/bss.h\
	$(BISYNC)/bsc.c
	$(CC) $(BISYNC)/bsc.c

bsc_req.o:\
	$(I_IMP)/gct.h\
	$(I_IMP)/msg.h\
	$(I_IMP)/modules.h\
	$(I_IMP)/types.h\
	$(I_IMP)/status.h\
	$(I_IMP)/fatal.h\
	$(BISYNC)/bss.h\
	$(BISYNC)/config.h\
	$(DRIVER)/mtypes.h\
	$(BISYNC)/bsc_req.c
	$(CC) $(BISYNC)/bsc_req.c

bsc_ascii.o:\
	$(I_IMP)/modules.h\
	$(I_IMP)/msg.h\
	$(BISYNC)/bss.h\
	$(BISYNC)/bsc_ascii.c
	$(CC) $(BISYNC)/bsc_ascii.c

bsc_tx.o:\
	$(I_IMP)/gct.h\
	$(I_IMP)/msg.h\
	$(I_IMP)/modules.h\
	$(I_IMP)/types.h\
	$(I_IMP)/status.h\
	$(I_IMP)/fatal.h\
	$(BISYNC)/bss.h\
	$(BISYNC)/bsc.h\
	$(BISYNC)/bsc_tx.c
	$(CC) $(BISYNC)/bsc_tx.c

bsc_rx.o:\
	$(I_IMP)/gct.h\
	$(I_IMP)/msg.h\
	$(I_IMP)/modules.h\
	$(I_IMP)/types.h\
	$(I_IMP)/status.h\
	$(BISYNC)/bss.h\
	$(BISYNC)/bsc.h\
	$(BISYNC)/bsc_rx.c
	$(CC) $(BISYNC)/bsc_rx.c
