L3ASRCS=$(srcdir)/config/sparc/solaris2/syscalls.S	\
	$(srcdir)/config/sparc/solaris2/gettimeofday.S	\
	$(srcdir)/config/sparc/solaris2/getctxt.S

L3CSRCS=$(srcdir)/config/generic/string/chkr-string.c	\
	$(srcdir)/config/generic/string/ffs.c		\
	$(srcdir)/config/sparc/solaris2/sigset.c	\
	$(srcdir)/config/sparc/solaris2/opendir.c	\
	$(srcdir)/config/sparc/solaris2/readdir.c	\
	$(srcdir)/config/sparc/solaris2/closedir.c	\
	$(srcdir)/config/sparc/solaris2/_dup2.c		\
	$(srcdir)/config/sparc/solaris2/__sbrk.c	\
	$(srcdir)/config/sparc/solaris2/sysconf.c	\
	$(srcdir)/config/sparc/solaris2/sigaction.c	\
	$(srcdir)/config/sparc/solaris2/ftruncate.c	\
	$(srcdir)/config/sparc/solaris2/solaris2.c	\
	$(srcdir)/config/sparc/solaris2/startup.c	\
	$(srcdir)/config/sparc/solaris2/mmap.c		\
	$(srcdir)/config/obj-formats/elf-stabs.c	\
	$(srcdir)/config/obj-formats/elf-symtab.c

L3AOBJS=gettimeofday.o getctxt.o

L3GSCOBJS=ffs.o chkr-string.o

L3COBJS1=sigset.o opendir.o readdir.o closedir.o solaris2.o _dup2.o sysconf.o \
  ftruncate.o sigaction.o __sbrk.o mmap.o gcc-sig.o
L3COBJS= $(L3COBJS1) startup.o

SIMOBJS=instr.o run_sim.o heap.o solaris-syscalls.o syscallname.o sig.o \
  simserver.o disassem.o

$(SIMOBJS):
	$(CC) -c $(ALL_CFLAGS) -I$(srcdir)/config/sparc/solaris2 $(srcdir)/config/sparc/sim/$*.c -o $@

$(SIMOBJS:.o=.c):
	$(CC) -S $(ALL_CFLAGS) -I$(srcdir)/config/sparc/solaris2 $(srcdir)/config/sparc/sim/$*.c -o $@

syscalls.o:
	$(CC) -E $(ALL_ASFLAGS) $(srcdir)/config/sparc/solaris2/syscalls.S | \
	 sed s/@function/#function/ > syscalls.s
	$(CC) -c $(ALL_ASFLAGS) syscalls.s -o syscalls.o
	$(RM) -f syscalls.s

$(L3AOBJS):
	$(CC) -c $(ALL_ASFLAGS) $(srcdir)/config/sparc/solaris2/$*.S -o $@

$(L3COBJS1):
	$(CC) -c $(ALL_CFLAGS) $(srcdir)/config/sparc/solaris2/$*.c -o $@

startup.o:
	$(CC) -c $(ALL_CFLAGS) -fdollars-in-identifiers $(srcdir)/config/sparc/solaris2/startup.c -o startup.o

$(L3GSCOBJS):
	$(CC) -c $(ALL_CFLAGS) $(srcdir)/config/generic/string/$*.c -o $@

elf-stabs.o:
	$(CC) -c $(ALL_CFLAGS) $(srcdir)/config/obj-formats/elf-stabs.c -o $@

elf-symtab.o:
	$(CC) -c $(ALL_CFLAGS) $(srcdir)/config/obj-formats/elf-symtab.c -o $@

#OBJS += $(L3AOBJS) $(L3COBJS) $(L3GSCOBJS) syscalls.o elf-stabs.o instr.o run_sim.o heap.o solaris-syscalls.o
CSRCS += $(L3CSRCS)
ASRCS += $(L3ASRCS)
#MDOBJS += $(LMD3COBJS) $(LMD3COBJS1) md-elf-stabs.o
#PLOBJS += $(LPL3COBJS) $(LPL3AOBJS) $(LPL3GSCOBJS) $(LPL3COBJS1)

#
syscalls.o: $(srcdir)/config/sparc/solaris2/syscalls.S
sigset.o: $(srcdir)/config/sparc/solaris2/sigset.c
opendir.o: $(srcdir)/config/sparc/solaris2/opendir.c $(srcdir)/checker.h
readdir.o: $(srcdir)/config/sparc/solaris2/readdir.c $(srcdir)/checker.h
closedir.o: $(srcdir)/config/sparc/solaris2/closedir.c $(srcdir)/checker.h
pl-bcopy.o bcopy.o: $(srcdir)/config/generic/string/bcopy.c
solaris2.o: $(srcdir)/config/sparc/solaris2/solaris2.c $(srcdir)/checker.h \
  ./machine.h ./message.h
_dup2.o: $(srcdir)/config/sparc/solaris2/_dup2.c $(srcdir)/checker.h \
  ./machine.h
__sbrk.o: $(srcdir)/config/sparc/solaris2/__sbrk.c
gettimeofday.o: $(srcdir)/config/sparc/solaris2/gettimeofday.S
startup.o: $(srcdir)/config/sparc/solaris2/startup.c $(srcdir)/checker.h
sysconf.o: $(srcdir)/config/sparc/solaris2/sysconf.c
mmap.o: $(srcdir)/config/sparc/solaris2/mmap.c
ftruncate.o: $(srcdir)/config/sparc/solaris2/ftruncate.c
sigaction.o: $(srcdir)/config/sparc/solaris2/sigaction.c
instr.o: $(srcdir)/config/sparc/sim/instr.c ./chkrsyscall.h \
  $(srcdir)/config/sparc/sim/instr.h $(srcdir)/checker.h  \
  $(srcdir)/lib/chkrlib.h $(srcdir)/lib/math-ieee.h \
  $(srcdir)/config/sparc/solaris2/math-sparc.h
run_sim.o: $(srcdir)/config/sparc/sim/run_sim.c \
  $(srcdir)/config/sparc/sim/instr.h \
  $(srcdir)/checker.h $(srcdir)/lib/chkrlib.h ./chkrsyscall.h
heap.o: $(srcdir)/config/sparc/sim/heap.c $(srcdir)/config/sparc/sim/instr.h
solaris-syscalls.o: $(srcdir)/config/sparc/sim/solaris-syscalls.c \
  $(srcdir)/config/sparc/sim/instr.h ./errlist.h ./machine.h
syscallname.o: $(srcdir)/config/sparc/sim/syscallname.c
simserver.o: $(srcdir)/config/sparc/sim/simserver.c \
  $(srcdir)/config/sparc/sim/instr.h \
  $(srcdir)/checker.h $(srcdir)/lib/chkrlib.h ./chkrsyscall.h
sig.o: $(srcdir)/config/sparc/sim/sig.c $(srcdir)/config/sparc/sim/instr.h \
  $(srcdir)/checker.h \
  $(srcdir)/lib/chkrlib.h ./chkrsyscall.h ./machine.h
getctxt.o: $(srcdir)/config/sparc/solaris2/getctxt.S
disassem.o: $(srcdir)/config/sparc/sim/disassem.c \
  $(srcdir)/config/sparc/sim/instr.h
chkr-string.o: $(srcdir)/config/generic/string/chkr-string.c ./chkr-string.h
