CC		= gcc
CCflags		= -c -O2 -ansi -mstubs -mthrowback -I^.lib
Link		= drlink
Linkflags	= -nounused -rescan

# options for linking with UnixLib
# OPTS		= -DHAVE_CONFIG_H

# options for linking with SharedCLibrary
OPTS		= -DHAVE_CONFIG_H -DACORN_SHARED_C_LIBRARY

LIBS		= ^.lib.o.gststubs gcc:o.libgcc ^.lib.o.libgnu ^.lib.o.mdwopt

DOLINK		= $(Link) $(Linkflags) o.$@ $(LIBS)

bin2c_Objs	= o.bin2c

# Main target

All:		bin2c

bin2c:		$(bin2c_Objs) $(LIBS) h.bin2c
		$(Link) $(Linkflags) $(bin2c_Objs) $(LIBS) -o bin2c

Clean:
		ifthere o.* then wipe o.* ~cfr~v
		remove h.bin2c
		remove mkbin2c
		remove bin2c

# Dependencies:

o.bin2c:	c.bin2c ^.lib.h.config ^.lib.h.system ^.lib.h.ro_file \
		^.lib.h.xalloc ^.lib.h.closeout ^.lib.h.version-etc \
		^.lib.h.mdwopt ^.lib.h.error h.bin2c
		$(CC) $(CCflags) $(OPTS) c.bin2c -o o.bin2c

h.bin2c:	mkbin2c
		cdir h
		<Prefix$$Dir>.mkbin2c > h.bin2c

mkbin2c:	o.mkbin2c ^.lib.o.gststubs gcc:o.libgcc
		$(Link) $(Linkflags) o.mkbin2c ^.lib.o.gststubs gcc:o.libgcc -o mkbin2c

o.mkbin2c:	c.mkbin2c
		$(CC) $(CCflags) $(OPTS) c.mkbin2c -o o.mkbin2c
