Index: /branches/v4/platforms/tsarv4_mono_mmu_ioc/Makefile
===================================================================
--- /branches/v4/platforms/tsarv4_mono_mmu_ioc/Makefile	(revision 636)
+++ /branches/v4/platforms/tsarv4_mono_mmu_ioc/Makefile	(revision 637)
@@ -1,10 +1,39 @@
+# where is soclib?
+SOCLIB_DIR=$(shell soclib-cc --getpath)
+
+# name definitions
 SOCLIB_DESC=desc.py
 SOCLIB_TOP=top.cpp
 SIMULATOR_BINARY=system.x
-
-SOCLIB_DIR=$(shell soclib-cc --getpath)
-
 SIMULATOR_CMD=./$(SIMULATOR_BINARY) --nobanner
 
+# extra arguments for compilation
+#SOCLIB_CC_ARGS=-v
+SOCLIB_CC_ARGS+=-b common:mips32
+
+# extra arguments for execution
+# gdb
+# F: start the simulation in a frozen state so it can be attached with a gdb client
+# X: disable automatic break whenever an exception is caught, the exception handler will be called transparently
+# S: make the simulation stop and wait for a gdb attachment whenever an exception is caught
+# C: dump a trace of every inter-functions branch
+# T: exit the simulator on trap exception
+# Z: same as C but display only function's entrypoint
+# W: disable automatic break whenever a watchpoint is hit, just report it on stderr (watchpoints can be defined using SOCLIB_GDB_WATCH)
+SIMULATOR_GDB=
+ifeq ("$(origin GDB)", "command line")
+ifeq ($(GDB), 1)
+	SIMULATOR_GDB=SOCLIB_GDB=FCX
+else
+	SIMULATOR_GDB=SOCLIB_GDB=$(GDB)
+endif
+endif
+# trace
+SIMULATOR_TRACE=
+ifeq ("$(origin TRACE)", "command line")
+	SIMULATOR_TRACE=--trace $(TRACE)
+endif
+
+# recipes
 all: $(SIMULATOR_BINARY)
 
@@ -13,8 +42,8 @@
 
 run_tsar_boot: all tsar_boot.bin disk.img
-	$(SIMULATOR_CMD) --rom tsar_boot.bin --dsk disk.img
+	$(SIMULATOR_GDB) $(SIMULATOR_CMD) --rom tsar_boot.bin --dsk disk.img $(SIMULATOR_TRACE)
 
 run_dummy_boot: all vmlinux disk.img
-	$(SIMULATOR_CMD) --rom vmlinux --dsk disk.img --dummy-boot
+	$(SIMULATOR_GDB) $(SIMULATOR_CMD) --rom vmlinux --dsk disk.img --dummy-boot $(SIMULATOR_TRACE)
 
 cscope.out:
