##	
## Xmas (X memory access simulator) is a little memory (+cache) simulator.
## Copyright (C) 1997/98/99/00  <Paolo Dovera pd514314@silab.dsi.unimi.it>
##                              <Paolo Dovera pdovera@tiscalinet.it>

## 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.

## Send any bug reports or comments to pd514314@silab.dsi.unimi.it
##                                     pdovera@tiscalinet.it
##

###############################################################################
# If you haven't the Makefile, create it with these step:                     #
# make -f Makefile.without.dep update                                         #
###############################################################################

###############################################################################
# USER DEFINITIONS                                                            #
###############################################################################
CC	= gcc #-v # verbose mode, explain the job
###
##### OFLAGS and EFLAGS are mutually exclusive!
###
# better optimization
# for 486 use -m486
# for pentium use -mcpu=pentium
# and so on ...
OFLAGS	= -O3 -march=i486 -Wno-unused -funroll-loops -fstrength-reduce -fomit-frame-pointer -ffast-math -malign-functions=2 -malign-jumps=2 -malign-loops=2 #-fno-strict-aliasing
# normal optimization
EFLAGS	= #-O2 -ffast-math -funroll-loops
# olny check for warnings => better code, more quality
CFLAGS	= $(EFLAGS) $(OFLAGS) -ansi -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wcast-align -Winline -Waggregate-return ###-Wpointer-arith -Wconversion (these checks generate many library warning! BAD!)

###############################################################################
# PROGRAM DEFINITIONS
###############################################################################
STRIP   = strip
EXEC_NAME= xmas
OBJ	= esp.o memory.o cache.o policy.o loader.o general_support.o GUI_support.o menuHELP.o menuWINDOW.o menuOPTION.o ChangeEntry.o Edit.o BrPts.o YNShell.o MemEditor.o Print.o Choose.o OpenSave.o Calc.o Search.o menuISTRCOUNTER.o pathexec.o ErrorMessage.o Preferences.o opthandler.o Sizer.o Email.o menuTUNING.o GUI.o

# Path and libraries
LIB	= -L/usr/X11R6/lib -lXaw -lXt -lXmu -lXext -lSM -lICE -lX11

### Make into subdirectories
MAKE	= make
CLEAN_SUBDIRS	= doc/italian
SUBDIRS	= doc/italian
ARGS	= -j 2 #"INCLUDE=/home/tullio/include" "LIB=/home/tullio/lib"

###############################################################################
# COMPILING                                                                   #
###############################################################################
all:	$(EXEC_NAME)

$(EXEC_NAME):	 $(OBJ)
	$(CC) $(CFLAGS) $(OBJ) -o $(EXEC_NAME) $(LIB)
	$(STRIP) $(EXEC_NAME)
	@echo "       *******************************************************"
	@echo "       * Thanks to use Xmas, the X memory access simulator   *"
	@echo "       * for any bugs, problems and other contact:           *"
	@echo "       * pd514314@silab.dsi.unimi.it                         *"
	@echo "       * pdovera@tiscalinet.it                               *"
	@echo "       *                                                     *"
	@echo "       * Regards,                                            *"
	@echo "       * Dovera Paolo                                        *"
	@echo "       *******************************************************"
	$(EXEC_NAME) #-sync

norun:	$(OBJ)
	$(CC) $(CFLAGS) $(OBJ) -o $(EXEC_NAME) $(LIB)
	$(STRIP) $(EXEC_NAME)

update:	
	gcc -MM *.c > dependencies
	cat Makefile.without.dep dependencies > Makefile
	rm -f dependencies

###############################################################################
# CLEAN section                                                               #
###############################################################################

clean:	
#	for i in $(CLEAN_SUBDIRS); do $(MAKE) -C $$i $(ARGS) clean; done
	rm -f *.o *.h~ *.c~ ?akefile~ images/*~ dependencies
	rm -f $(EXEC_NAME)

#ci:	
#	ci -r4.3 -f -l *

###############################################################################
# DEPENDENCIES (generated by make update) (do not write under this lines!)    #
###############################################################################
BrPts.o: BrPts.c ErrorMessage.h BrPts.h YNShell.h GUI_support.h \
 loader.h memory.h esp.h global.h
Calc.o: Calc.c ErrorMessage.h Calc.h GUI_support.h esp.h
ChangeEntry.o: ChangeEntry.c ErrorMessage.h ChangeEntry.h \
 GUI_support.h policy.h cache.h memory.h
Choose.o: Choose.c ErrorMessage.h Choose.h GUI_support.h
Edit.o: Edit.c images/xlogo11 ErrorMessage.h config.h Email.h \
 OpenSave.h Print.h Choose.h YNShell.h Edit.h GUI_support.h loader.h \
 policy.h memory.h general_support.h esp.h global.h
Email.o: Email.c Email.h opthandler.h GUI_support.h ErrorMessage.h \
 global.h
ErrorMessage.o: ErrorMessage.c ErrorMessage.h config.h Sizer.h Email.h \
 pathexec.h general_support.h Preferences.h Search.h OpenSave.h \
 Choose.h Print.h MemEditor.h menuHELP.h YNShell.h BrPts.h Edit.h \
 ChangeEntry.h errormessage.h GUI.h GUI_support.h loader.h policy.h \
 cache.h memory.h global.h
GUI.o: GUI.c images/xlogo11 images/icon images/runner images/general \
 images/mode images/smile_computer config.h opthandler.h Email.h \
 Sizer.h Preferences.h ErrorMessage.h pathexec.h Search.h Calc.h \
 OpenSave.h general_support.h GUI_support.h Choose.h MemEditor.h \
 YNShell.h menu.h menuHELP.h menuISTRCOUNTER.h BrPts.h Edit.h \
 ChangeEntry.h GUI.h loader.h policy.h cache.h memory.h esp.h global.h \
 xmas-app-defaults.h
GUI_support.o: GUI_support.c ErrorMessage.h GUI_support.h GUI.h \
 loader.h policy.h cache.h memory.h global.h images/crono_base_1 \
 images/crono_base_2 images/crono_base_3 images/crono_base_4 \
 images/crono_base_5 images/crono_base_6 images/crono_base_7 \
 images/crono_base_8 images/crono_base_9 images/crono_base_10 \
 images/crono_base_11 images/crono_base_12
MemEditor.o: MemEditor.c opthandler.h ErrorMessage.h MemEditor.h \
 Edit.h GUI_support.h loader.h policy.h memory.h global.h
OpenSave.o: OpenSave.c ErrorMessage.h OpenSave.h YNShell.h \
 GUI_support.h esp.h global.h
Preferences.o: Preferences.c ErrorMessage.h Preferences.h \
 general_support.h GUI_support.h opthandler.h YNShell.h global.h
Print.o: Print.c opthandler.h ErrorMessage.h Print.h Choose.h \
 general_support.h Edit.h config.h global.h
Search.o: Search.c ErrorMessage.h Search.h GUI_support.h memory.h
Sizer.o: Sizer.c global.h Sizer.h ErrorMessage.h GUI_support.h
YNShell.o: YNShell.c ErrorMessage.h YNShell.h GUI_support.h
cache.o: cache.c opthandler.h general_support.h cache.h memory.h esp.h \
 global.h
esp.o: esp.c esp.h
general_support.o: general_support.c general_support.h opthandler.h \
 ErrorMessage.h errormessage.h config.h Edit.h GUI_support.h loader.h \
 policy.h cache.h memory.h global.h
loader.o: loader.c general_support.h opthandler.h pathexec.h BrPts.h \
 Edit.h loader.h loaderP.h policy.h cache.h memory.h esp.h global.h
memory.o: memory.c general_support.h opthandler.h memory.h esp.h \
 global.h
menuHELP.o: menuHELP.c ErrorMessage.h menu.h menuHELP.h \
 images/question global.h
menuISTRCOUNTER.o: menuISTRCOUNTER.c ErrorMessage.h menu.h \
 menuISTRCOUNTER.h GUI_support.h loader.h global.h
menuOPTION.o: menuOPTION.c Preferences.h menu.h Edit.h global.h \
 images/xlogo11
menuTUNING.o: menuTUNING.c menu.h global.h Sizer.h loader.h
menuWINDOW.o: menuWINDOW.c menu.h pathexec.h Edit.h BrPts.h \
 MemEditor.h Calc.h global.h
opthandler.o: opthandler.c general_support.h opthandler.h global.h
pathexec.o: pathexec.c global.h opthandler.h general_support.h \
 OpenSave.h ErrorMessage.h pathexec.h GUI_support.h loader.h policy.h \
 esp.h
policy.o: policy.c general_support.h opthandler.h policy.h cache.h \
 esp.h global.h
