#    Makefile for ARMulator:  ARM6 Instruction Emulator.
#    Copyright (C) 1994 Advanced RISC Machines Ltd.
# 
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
# 
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
# 
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# hacked for Archimedes emulation by Dave Gilbert (armul@treblig.org)

# These variables can be overridden

#Default endianness of the processor (LITTLEEND or BIGEND)
ENDIAN=LITTLEEND

prefix=/usr/local
CC = gcc
CFLAGS = -O6 -D$(ENDIAN) $(CFL) -Wall -DNOOS -DNOFPE
INSTALL_DIR = $(prefix)/bin
INSTALL=cp

# Everything else should be ok as it is.

OBJS = armcopro.o armemu26.o arminit.o \
	armsupp.o main.o dagstandalone.o armos.o \
		bag.o armrdi.o arch/DispKbd.o arch/i2c.o arch/archio.o \
    arch/fdc1772.o arch/ControlPane.o arch/hdc63463.o arch/ReadConfig.o

SRCS = armcopro.c armemu.c arminit.c arch/armarc.c \
	armsupp.c main.c dagstandalone.c armos.c \
	bag.c armrdi.c arch/DispKbd.c arch/i2c.o arch/archio.o \
	arch/fdc1772.c arch/ControlPane.c arch/hdc63463.c arch/ReadConfig.c

INCS = armdefs.h armemu.h armfpe.h armopts.h bag.h armos.h \
	dbg_conf.h dbg_cp.h dbg_hif.h dbg_rdi.h arch/KeyTable.h \
  arch/i2c.h arch/archio.h arch/fdc1772.h arch/ControlPane.h \
  arch/hdc63463.h

TARED = $(SRCS) $(INCS) README COPYING Makefile

MODEL = arch/armarc

VER=1.0

all: armul-arc

install: all
	$(INSTALL) armul $(INSTALL_DIR)

armul-arc: $(OBJS) $(MODEL).o
	$(CC) $(CFLAGS) $(OBJS) $(MODEL).o -o $@ -L/usr/X11/lib -lm -lXext -lX11

clean:
	rm -f *.o arch/*.o armul-arc core

distclean: clean
	rm -f *~

realclean: distclean
	rm -f *.tar *.tar.gz

depend:
	makedepend $(SRCS)

armul.tar.gz: 
	rm -rf armul-$(VER)
	mkdir armul-$(VER)
	cd armul-$(VER) ; \
	for file in $(TARED) ; do \
	  ln ../$${file} . ; \
	done 
	tar cf armul.tar armul-$(VER)
	gzip armul.tar
	mv armul.tar.gz armul-$(VER).tar.gz

# memory models

arch/armarc.o: armdefs.h arch/armarc.c arch/DispKbd.h arch/armarc.h arch/fdc1772.h
	$(CC) $(CFLAGS) -c $*.c -o arch/armarc.o

# other objects

armos.o: armos.c armdefs.h armos.h armfpe.h
	$(CC) $(CFLAGS) -c $*.c

armcopro.o: armcopro.c armdefs.h 
	$(CC) $(CFLAGS) -c $*.c

armemu26.o: armemu.c armdefs.h armemu.h 
	$(CC) $(CFLAGS) -o armemu26.o -c armemu.c

#armemu32.o: armemu.c armdefs.h armemu.h
#	$(CC) $(CFLAGS) -o armemu32.o -DMODE32 -c armemu.c

arminit.o: arminit.c armdefs.h armemu.h
	$(CC) $(CFLAGS) -c $*.c

armrdi.o: armrdi.c armdefs.h armemu.h armos.h dbg_cp.h dbg_conf.h dbg_rdi.h \
		dbg_hif.h
	$(CC) $(CFLAGS) -c $*.c

armsupp.o: armsupp.c armdefs.h armemu.h
	$(CC) $(CFLAGS) -c $*.c

dagstandalone.o: dagstandalone.c armdefs.h dbg_conf.h dbg_hif.h dbg_rdi.h
	$(CC) $(CFLAGS) -c $*.c

main.o: main.c armdefs.h dbg_rdi.h dbg_conf.h
	$(CC) $(CFLAGS) -c $*.c

bag.o: bag.c bag.h
	$(CC) $(CFLAGS) -c $*.c

arch/DispKbd.o: arch/DispKbd.c arch/DispKbd.h arch/KeyTable.h arch/armarc.h arch/fdc1772.h arch/hdc63463.h
	$(CC) $(CFLAGS) -c $*.c -o arch/DispKbd.o

arch/i2c.o: arch/i2c.c arch/i2c.h arch/armarc.h arch/DispKbd.h arch/archio.h arch/fdc1772.h arch/hdc63463.h
	$(CC) $(CFLAGS) -c $*.c -o arch/i2c.o

arch/archio.o: arch/archio.c arch/archio.h arch/armarc.h arch/i2c.h arch/DispKbd.h arch/fdc1772.h arch/hdc63463.h
	$(CC) $(CFLAGS) -c $*.c -o arch/archio.o

arch/fdc1772.o: arch/fdc1772.c arch/fdc1772.h arch/armarc.h
	$(CC) $(CFLAGS) -c $*.c -o arch/fdc1772.o

arch/hdc63463.o: arch/hdc63463.c arch/hdc63463.h arch/armarc.h
	$(CC) $(CFLAGS) -c $*.c -o arch/hdc63463.o

arch/ControlPane.o: arch/ControlPane.c arch/ControlPane.h arch/DispKbd.h arch/armarc.h
	$(CC) $(CFLAGS) -c $*.c -o arch/ControlPane.o
# DO NOT DELETE
