#
# /emx/test/makefile
#
CFLAGS=-g -Wall
CC=gcc $(CFLAGS)
B=/emx/bin/
I=/emx/include/
L=/emx/lib/
SIGNAL=$(I)signal.h $(I)sys/signal.h
FCNTL=$(I)fcntl.h $(I)sys/fcntl.h
LIBS=$(L)crt0.o $(L)libc.a $(L)libgcc.a
LIBOS2=$(L)libos2.a

.SUFFIXES: .o .c .s .exe

.c.o:
	$(CC) -c $*.c

.c.s:
	$(CC) -S $*.c

.o.exe:
	$(CC) -o $*.exe $*.o

default:        all

all:            access.exe alarm.exe align.s args.exe coretest.exe \
                coretst2.exe ctypetst.exe debug.exe divtest.exe exec.exe \
                float.exe fullpath.exe hexdump.exe math.exe memory.exe \
                memtest.exe os2test.exe pid.exe pipe.exe pm1.exe popen.exe \
                printf.exe retcode.exe sbrktest.exe scanf.exe showmem.exe \
                sieve.exe sig1.exe sig2.exe sig3.exe sort.exe stack.exe \
                stdio.exe system.exe termio.exe timetest.exe tmpnam.exe \
                trunc.exe version.exe

clean:
	-del *.o
	-del *.exe
	-del align.s
	-del coretest
	-del coretest.cor
	-del mathtest.out
	-del pm1
	-del pm1.res

access.o:       access.c $(I)stdio.h $(I)io.h
alarm.o:        alarm.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(SIGNAL)
align.s:        align.c
args.o:         args.c $(I)stdio.h $(I)stdlib.h
coretest.o:     coretest.c $(I)stdio.h $(I)stdlib.h $(I)io.h $(FCNTL) \
                $(I)sys/types.h $(I)sys/stat.h
ctypetst.o:     ctypetst.c $(I)stdio.h $(I)string.h $(I)ctype.h
debug.o:        debug.c $(I)stdio.h $(I)string.h $(I)process.h \
                $(I)sys/ptrace.h $(I)sys/reg.h $(I)sys/user.h $(I)stdlib.h
divtest.o:      divtest.c $(I)stdio.h $(I)stdlib.h
exec.o:         exec.c $(I)stdio.h $(I)string.h $(I)process.h $(I)signal.h
float.o:        float.c $(I)stdio.h $(I)float.h
fullpath.o:     fullpath.c $(I)stdio.h $(I)stdlib.h $(I)sys/param.h
hexdump.o:      hexdump.c $(I)stdio.h $(I)stdlib.h $(I)io.h $(FCNTL)
math.o:         math.c $(I)stdio.h $(I)stdlib.h $(I)math.h
memory.o:       memory.c $(I)stdio.h $(I)string.h
memtest.o:      memtest.c $(I)sys/emx.h $(I)stdio.h $(I)stdlib.h \
                $(I)string.h $(I)io.h
os2test.o:      os2test.c $(I)stdio.h $(I)string.h $(I)os2.h
pid.o:          pid.c $(I)stdio.h $(I)process.h
pipe.o:         pipe.c $(I)stdio.h $(I)io.h $(I)process.h $(I)unistd.h \
                $(I)stdlib.h $(FCNTL) $(I)string.h
pm1.o:          pm1.c pm1.h $(I)stdio.h $(I)os2.h
popen.o:        popen.c $(I)stdio.h $(I)stdlib.h $(I)string.h
printf.o:       printf.c $(I)stdio.h
retcode.o:      retcode.c $(I)stdlib.h
sbrktest.o:     sbrktest.c $(I)stdio.h $(I)stdlib.h $(I)string.h
scanf.o:        scanf.c $(I)stdio.h
showmem.o:      showmem.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(I)os2.h
sieve.o:        sieve.c $(I)stdio.h $(I)stdlib.h $(I)memory.h
sig1.o:         sig1.c $(I)stdio.h $(SIGNAL)
sig2.o:         sig1.c $(I)stdio.h $(I)stdlib.h $(SIGNAL) $(I)setjmp.h \
                $(I)process.h
sig3.o:         sig3.c $(I)stdio.h $(I)stdlib.h $(SIGNAL) $(I)setjmp.h
sort.o:         sort.c $(I)stdio.h $(I)stdlib.h $(I)string.h
stack.o:        stack.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(SIGNAL) \
                $(I)alloca.h
stdio.o:        stdio.c $(I)stdio.h $(I)stdlib.h
system.o:       system.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(I)process.h
termio.o:       termio.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(I)io.h \
                $(I)errno.h $(SIGNAL) $(I)process.h $(I)setjmp.h \
                $(I)sys/termio.h $(I)fcntl.h $(I)sys/ioctl.h
timetest.o:     timetest.c $(I)stdio.h $(I)time.h $(I)sys/types.h \
                $(I)sys/stat.h $(I)io.h
tmpnam.o:       tmpnam.c $(I)stdio.h
trunc.o:        trunc.c $(I)stdio.h $(I)stdlib.h $(I)io.h
version.o:      version.c $(I)stdio.h $(I)stdlib.h $(I)string.h $(I)sys/emx.h

access.exe:     access.o $(LIBS)
	$(CC) -o access.exe access.o

alarm.exe:      alarm.o $(LIBS)
	$(CC) -o alarm.exe alarm.o

args.exe:       args.o $(LIBS)
	$(CC) -o args.exe args.o

coretest:       coretest.o $(LIBS)
	$(CC) -o coretest coretest.o

coretest.exe:   coretest
	emxbind $(B)emxl coretest

coretest.cor:   coretest.exe
	coretest

coretst2.exe:   coretest coretest.cor
	emxbind -ccoretest.cor $(B)emxl coretest coretst2

ctypetst.exe:   ctypetst.o $(LIBS)
	$(CC) -o ctypetst.exe ctypetst.o

debug.exe:      debug.o $(LIBS)
	$(CC) -o debug.exe debug.o

divtest.exe:    divtest.o $(LIBS)
	$(CC) -o divtest.exe divtest.o

exec.exe:       exec.o $(LIBS)
	$(CC) -o exec.exe exec.o
	emxbind -aq exec -p

float.exe:      float.o $(LIBS)
	$(CC) -o float.exe float.o

fullpath.exe:   fullpath.o $(LIBS)
	$(CC) -o fullpath.exe fullpath.o

hexdump.exe:    hexdump.o $(LIBS)
	$(CC) -o hexdump.exe hexdump.o

math.exe:       math.o $(LIBS)
	$(CC) -o math.exe math.o

memory.exe:     memory.o $(LIBS)
	$(CC) -o memory.exe memory.o

memtest.exe:    memtest.o $(LIBS)
	$(CC) -o memtest.exe memtest.o

os2test.exe:    os2test.o $(LIBS) $(LIBOS2)
	$(CC) -o os2test.exe os2test.o -los2

pid.exe:        pid.o $(LIBS)
	$(CC) -o pid.exe pid.o

pipe.exe:       pipe.o $(LIBS)
	$(CC) -o pipe.exe pipe.o

pm1.res:        pm1.rc pm1.h
	rc -r -i \emx\include pm1.rc

pm1:            pm1.o $(LIBS) $(LIBOS2)
	$(CC) -o pm1 pm1.o -los2

pm1.exe:        pm1 pm1.res
	emxbind -bpq -rpm1.res /emx/bin/emxl pm1

popen.exe:      popen.o $(LIBS)
	$(CC) -o popen.exe popen.o

printf.exe:     printf.o $(LIBS)
	$(CC) -o printf.exe printf.o

retcode.exe:    retcode.o $(LIBS)
	$(CC) -o retcode.exe retcode.o

sbrktest.exe:   sbrktest.o $(LIBS)
	$(CC) -o sbrktest.exe sbrktest.o

scanf.exe:      scanf.o $(LIBS)
	$(CC) -o scanf.exe scanf.o

showmem.exe:    showmem.o $(LIBS) $(LIBOS2)
	$(CC) -o showmem.exe showmem.o -los2

sieve.exe:      sieve.o $(LIBS)
	$(CC) -o sieve.exe sieve.o

sig1.exe:       sig1.o $(LIBS)
	$(CC) -o sig1.exe sig1.o

sig2.exe:       sig2.o $(LIBS)
	$(CC) -o sig2.exe sig2.o

sig3.exe:       sig3.o $(LIBS)
	$(CC) -o sig3.exe sig3.o

sort.exe:       sort.o $(LIBS)
	$(CC) -o sort.exe sort.o

stack.exe:      stack.o $(LIBS)
	$(CC) -o stack.exe stack.o

stdio.exe:      stdio.o $(LIBS)
	$(CC) -o stdio.exe stdio.o

system.exe:     system.o $(LIBS)
	$(CC) -o system.exe system.o
	emxbind -aq system -p

termio.exe:     termio.o $(LIBS)
	$(CC) -o termio.exe termio.o

timetest.exe:   timetest.o $(LIBS)
	$(CC) -o timetest.exe timetest.o

tmpnam.exe:     tmpnam.o $(LIBS)
	$(CC) -o tmpnam.exe tmpnam.o

trunc.exe:      trunc.o $(LIBS)
	$(CC) -o trunc.exe trunc.o

version.exe:    version.o $(LIBS)
	$(CC) -o version.exe version.o
