# This builds the PDOS-generic OS library for mainframe

# PDOS386 is a misnomer and should be renamed to PDOSGENOS
# (not PDOSGEN which is for pdos-generic apps)
# That migration process has now started in conjunction with
# migrating to PosFopen etc

# Need to disable builtins because an ASCII/EBCDIC issue
# means that it thinks there is no '%' and can use an fputs

CC=gccmvs
AS=as370 -mhlasm -mebcdic
COPTS=-S -Os -fno-common -U__MVS__ -D__MF32__ -D__PDOS386__ \
    -DNOLIBALLOC -D__NOBIVA__ -I . -I../pdpclib -I../src \
    -DUSE_MEMMGR -fno-builtin -DNOUNDMAIN -D__PDOSGENOS__ \
    -DWINNEWMOD -D__GENSHELL__

all: clean pdosgeno.a

pdosgeno.a: stdio.o string.o stdlib.o \
       start.o time.o errno.o assert.o signal.o locale.o \
       ctype.o setjmp.o math.o zpgsupa.o pdossupc.o
        rm -f pdosgeno.a
        xar r pdosgeno.a stdio.o string.o stdlib.o zpgsupa.o
        xar r pdosgeno.a start.o time.o errno.o assert.o signal.o
        xar r pdosgeno.a locale.o ctype.o setjmp.o math.o pdossupc.o
        xar s pdosgeno.a

.c.o:
        $(CC) $(COPTS) -o $*.s $<
        $(AS) -o $@ $*.s
        rm -f $*.s

.asm.o:
        $(AS) -o $@ $<

clean:
        rm -f pdosgeno.a
