#
# Makefile - This is a makefile for the XBBS System (7.9.1)
#
# This makefile is designed to compile the XBBS Software under wide range
# of operating systems. Please look at the makefile for additional info.
# Please send any comments, suggestions, or changes for this makefile to: 
# Howard Leadmon (howardl@wb3ffv.ampr.org) 
#
# The XBBS System was designed by Sandy Zelkovitz
#
# Note: This makefile at present is not part of the standard XBBS system
#

# Setup compile ruleset

.c:
	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)

# Set Macros

CC	= cc
LDFLAGS	= -s
BINDIR	= /usr/bbs  # Location where you want the XBBS binaries installed!

# List of objects

OBJECTS	= bbsc1.o bbsc2.o bbscport.o bbsclock.o bbscfile.o bbscmisc.o \
	bbscio.o bbscarea.o bbscmsga.o bbscqust.o bbscbult.o bbscadds.o \
	bbsclist.o bbsczip.o bbscconf.o bbscsumm.o bbscsigs.o bbscmenu.o

#
# Select System Type
#

dummy:
	@echo You need to specify the OS Type!!
	@echo Valid types are: sysv32 sysv3 sysv2 x286 x386 att3b1

# For System V Release 3.2  (using shared libs and Xenix libs)
sysv32:
	make xbbs "CFLAGS = -O -DSYSV" "LIBS = -lc_s" "XENIXLIB = -lx"

# For System V Release 3.0 and 3.1  (using shared libs)
sysv3:
	make xbbs "CFLAGS = -O -DSYSV" "LIBS = -lc_s" 

# For System V Release 2.x 
sysv2:	
	make xbbs "CFLAGS = -O -DSYSV -DSYSV2" "LIBS = -lc"

# For Xenix-286
x286:	
	make xbbs "CFLAGS = -O -Ml2" "LIBS = -lx" "LDFLAGS = -s -F 40000"
	rm sealink
	make sealink "CFLAGS = -Ms -i -Ox -K" "LDFLAGS = -F 0400 -s"

# For Xenix-386
x386:	
	make xbbs "CFLAGS = -Ox" "LIBS = -lx"

# For the AT&T 3b1 Computer
att3b1:	
	make xbbs "CFLAGS = -O -DSYSV -DATT3B1" "LIBS = -lc"

# Generate code

xbbs:	readme bbsc1 allign chatbbs listuser listusers sealink xbbsgen ymodem \
	crc checksum purguser
	@echo "\nAll XBBS binaries are up to date!"
	@echo "Check msgpack and today directories for suppliments"
	@echo '\nType "make install" to move executables to $(BINDIR)\n'

readme: 
	@more README.1st

bbsc1:	$(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(XENIXLIB) $(LIBS)

chatbbs:	chatbbs.c chat.h
	$(CC) $(CFLAGS) $(LDFLAGS) chatbbs.c -o $@ $(LIBS)

install:	
	mv bbsc1 allign chatbbs listuser listusers sealink crc checksum \
	ymodem xbbsgen $(BINDIR)

clean:
	rm -f *.o core bbsc1 allign chatbbs listuser listusers sealink crc \
	checksum ymodem xbbsgen 

# List dependants for bbsc1 (Xbbs)

bbsc1.o: bbsc1.c bbsc12.h

bbsc2.o: bbsc2.c bbsc12.h

bbscport.o: bbscport.c bbscdef.h

bbsclock.o: bbsclock.c bbscdef.h

bbscfile.o: bbscfile.c bbscdef.h

bbscmisc.o: bbscmisc.c bbscdef.h

bbscio.o: bbscio.c

bbscarea.o: bbscarea.c bbscdef.h

bbscmsga.o: bbscmsga.c bbscdef.h

bbscqust.o: bbscqust.c bbscdef.h

bbscbult.o: bbscbult.c bbscdef.h

bbscadds.o: bbscadds.c bbscdef.h

bbsczip.o: bbsczip.c bbscdef.h

bbsclist.o: bbsclist.c bbscdef.h

bbscconf.o: bbscconf.c bbscdef.h

bbscsumm.o: bbscsumm.c bbscdef.h

bbscsigs.o: bbscsigs.c bbscdef.h

bbscmenu.o: bbscmenu.c bbsc12.h
#
# End of Makefile for the XBBS System
#