######################
#    archive         #
######################

VER	=	2.2
REV	=	.10

SHAR	=	onew$(VER)$(REV).shar
TAR	=	onew$(VER)$(REV).tar
DIST	=	onew$(VER)$(REV).dist

VIAFS	=	via+onew.c ojstevie/via+stevie.c
SAMPLE	=	sample/Makefile sample/*.c

SRCS1	=	README.ONEW
SRCS2	=	Makefile mkmakefile mkrktab ONEW_CONF.default \
		engine/Makefile interface/Makefile dialogue/Makefile \
		sys/Makefile stabs/Makefile ojstevie/Makefile \
		*.h *.c \
		stabs/*.c \
		engine/*.h engine/*.c \
		interface/*.c \
		$(VIAFS) \
		$(SAMPLE) \
		ojstevie/ojstevie-patch ojstevie/onew+stevie.c \
		okdraw/okdraw-patch okdraw/onewedit.c \
		dialogue/*.c dialogue/keisen/*

SRCS	=	$(SRCS1) $(SRCS2)

LIBOBJS	=	onewver.o onewlib.o \
		onewclient.o onewcodes.o onewmisc.o \
		conf.o onew_euc.o rktab.o

RANLIB	=	echo

MAKEFILE =	Makefile.go
# BOOT_BEGIN ###########################################################
boot:		$(MAKEFILE)
		make -f $(MAKEFILE)
$(MAKEFILE):	Makefile mkmakefile ONEW_CONF.default ONEW_CONF
		./mkmakefile $(MAKEFILE)
ONEW_CONF:;	./mkmakefile ONEW_CONF $(NO_SYMLINK)
# BOOT_END ############################################################

ALLLIBS	=	libonew.a $(RKKLIBS) $(VIALIB) $(MISCLIB)

.c.o:
	$(CC) -c $(CFLAGS) $*.c

MKCORE =	mkstabs mkinterface mkdialogue mksys

######################
#    libonew.a       #
######################
all:		$(MKCORE) libonewk.a mkengine libonew.a onew $(MKRKTAB)

test:		onew
		echo 'watasinonamaewa' | ./onew

clean:;		rm -f stabs/*.o  stabs/*.bak  stabs/core
		rm -f sample/*.o sample/*.bak sample/core
		cd engine; make clean
		cd dialogue; make clean
		rm -f sys/*.o sys/libsys.a sys/*.bak sys/core
		rm -f interface/*.o   interface/libuif.a 
		rm -f interface/*.bak interface/core
		rm -f $(MAKEFILE) *.o libonew*.a onew
		rm -f *.bak core

exe:		libonew.a onew

mkstabs:;	cd stabs; make CFLAGS="${CFLAGS}" CC="${CC}"
mkinterface:;	cd interface; make CFLAGS="${CFLAGS}" CC="${CC}"
mkdialogue:;	cd dialogue; make CFLAGS="${CFLAGS}" CC="${CC}"
mkengine:;	cd engine; make CFLAGS="${CFLAGS}" CC="${CC}"
mksys:;		cd sys; make CFLAGS="${CFLAGS}" CC="${CC}"


libonewk.a:	$(MAKEFILE) $(LIBOBJS) \
	interface/libuif.a dialogue/libdialogue.a sys/libsys.a
		rm -f libonewk.a
		ar rc libonewk.a $(LIBOBJS)
		ar r  libonewk.a interface/*.o
		ar r  libonewk.a dialogue/*.o
		ar r  libonewk.a sys/*.o
		$(RANLIB) libonewk.a

libonew.a:	libonewk.a engine/libengine.a
		cp libonewk.a libonew.a
		(cd engine; ar r ../libonew.a $(RKKOBJS))
		(cd stabs; ar r ../libonew.a *.o)
		$(RANLIB) libonew.a

onewlib.o:	onew.h onewlib.c
		$(CC) -c $(CFLAGS) onewlib.c

conf.o:		ONEW_CONF.default ONEW_CONF onew.h conf.c
		$(CC) -c $(CFLAGS) -DONEW_ENGINE=$(ONEW_ENGINE) $(ONEW_RKTABS)\
		 conf.c

onewclient.o:	onew.h onewclient.c
		$(CC) -c $(CFLAGS) onewclient.c

onew:		onew.o libonew.a
		$(CC) $(LDOPTS) -o onew onew.o sys/hpux.o $(ALLLIBS)

onew.o:		onew.h onew.c
		$(CC) -c $(CFLAGS) onew.c

onewver.o:	onew.h onewver.c

rktab.c:	mkrktab
		./mkrktab -
		rm -f rktab++

rktab++:	$(MAKEFILE) mkrktab engine/libengine.a
		./mkrktab +
		touch rktab++
		make

######################
#    onew + stevie   #
######################
stevie:			ojstevie/ojstevie
ojstevie/ojstevie:	$(SRCS)
			cd ojstevie; make

######################
#    onew + kdraw    #
######################
idraw:		okdraw/okdraw
okdraw/okdraw:	kdraw/SUN4/a.out
		cp kdraw/SUN4/a.out okdraw/okdraw

kdraw/SUN4/a.out:\
	libonew.a \
	okdraw/textedit.h okdraw/textedit.c okdraw/onewedit.c okdraw/main.c
	cd kdraw/SUN4; make

######################
#    archive         #
######################
ar:		shar tar dist
shar:		$(SHAR)
$(SHAR):	$(SRCS)
		echo "mkdir ojstevie; mkdir okdraw" > $(SHAR); \
		shar2 -v $(SRCS) >> $(SHAR); \
		cp -p $(SHAR) onew.shar

tar:		$(TAR)
$(TAR):		$(SRCS) sys/*.h sys/*.c
		rm -f rktab.c
		tar cf  $(TAR) $(SRCS)
		tar uhf $(TAR) sys/*.h sys/*.c
		cp -p $(TAR) onew.tar

uu:		tar
		gzip -9 $(TAR)
		uuencode $(TAR).gz $(TAR).gz > uu

dist:		$(DIST)
$(DIST):	$(SRCS) $(TAR)
		compress $(TAR) -c |uuencode $(TAR).Z > $(DIST)

ver:;		echo $(WNNVER)
LibSpec:;	echo "'"$(RKKLIBS)"'"


syntax highlighted by Code2HTML, v. 0.9.1