# Copyright (C) 1995 by Klaus Gebhardt

include ../../../makeversions

VERSION = 0.4

LIBDIR = $(EMXDIR)/lib
INCDIR = $(EMXDIR)/include/cpp
INFDIR = $(infodir)
DLLDIR = $(OCTDIR)/dll

AR = ar
AR_FLAGS = rc
RANLIB = ar s

CC = gcc
CFLAGS = -O2 -fno-rtti -D__ST_MT_ERRNO__ -DEMX -I.

ZFLAGS = -Zdll -Zcrtdll

%.o: %.c;	$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cc;	$(CC) $(CFLAGS) -c $< -o $@

%.obj: %.c;	$(CC) $(CFLAGS) -c $< -o $@ -Zomf
%.obj: %.cc;	$(CC) $(CFLAGS) -c $< -o $@ -Zomf

%.lib: %.a;	emxomf -s -l $<

IO_OBJECTS = filedoalloc.o floatconv.o genops.o fileops.o iovfprintf.o \
  iovfscanf.o ioignore.o iopadn.o iofgetpos.o iofread.o iofscanf.o \
  iofsetpos.o iogetdelim.o iogetline.o ioprintf.o ioseekoff.o ioseekpos.o \
  outfloat.o strops.o iofclose.o iopopen.o ioungetc.o peekc.o iogetc.o \
  ioputc.o iofeof.o ioferror.o iosystem.o

STDIO_OBJECTS = stdfiles.o

STDIO_WRAP_OBJECTS =  iofdopen.o iofflush.o iofgets.o iofopen.o iofprintf.o \
  iofputs.o iofwrite.o iogets.o ioperror.o ioputs.o ioscanf.o iosetbuffer.o \
  iosetvbuf.o iosprintf.o iosscanf.o ioftell.o iovsscanf.o iovsprintf.o

IOSTREAM_OBJECTS = builtinbuf.o filebuf.o fstream.o indstream.o ioassign.o \
  ioextend.o iomanip.o iostream.o isgetline.o isgetsb.o isscan.o \
  osform.o procbuf.o procstream.o sbform.o sbgetline.o sbscan.o \
  stdiostream.o stdstrbufs.o stdstreams.o stream.o streambuf.o strstream.o \
  PlotFile.o SFile.o parsestream.o pfstream.o editbuf.o

OSPRIM_OBJECTS = ioprims.o iostrerror.o cleanup.o

OBJECTS = $(IO_OBJECTS) $(IOSTREAM_OBJECTS) $(OSPRIM_OBJECTS)

LIBS = ../stdcpp.a ../stdcpp.lib

INCS = ../procbuf.h ../procstream.h

all: $(LIBS) $(INCS)
.PHONY: all

../stdcpp.a: $(OBJECTS)
	$(AR) $(AR_FLAGS) ../stdcpp.a $(OBJECTS)

../stdcpp.lib: ../stdcpp.a

../procbuf.h: procbuf.h
	cp procbuf.h ../procbuf.h

../procstream.h: procstream.h
	cp procstream.h ../procstream.h

build: clean all
.PHONY: build

clean:
	rm -f *.o *.obj *.a *.lib *.def *.dll
.PHONY: clean
