# /**(c)
# 
#   Copyright (C) 2006, 2007, 2008, 2009 Michael Stilkerich, Johannes Bauer, Christian Wawersich 
# 
#   This file is part of the JOSEK operating system.
# 
# 	JOSEK is free software: you can redistribute it and/or modify it under the
#   terms of the Lesser GNU General Public License as published by the Free
#   Software Foundation, either version 3 of the License, or (at your option)
#   any later version.
# 
# 	JOSEK 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 Lesser General Public License for
#   more details. You should have received a copy of the GNU Lesser General
#   Public License along with JOSEK. If not, see <http://www.gnu.org/licenses/>.
# 
#   Please contact keso@cs.fau.de for more info.
# 
#   (c)**/
CC = gcc
#CFLAGS = -O2 -Wall
LDFLAGS = 
CFLAGS = -O0 -Wall -ggdb3
APPLICATION = testtask
SUPPLEMENTARY = OS.h
OBJS = OS.o dispatch.o

all: $(APPLICATION)

clean:
	rm -f $(APPLICATION) $(OBJS)

test: $(APPLICATION)
	./$(APPLICATION)

kill:
	killall -9 $(APPLICATION)

valgrind: $(APPLICATION)
	valgrind ./$(APPLICATION)


$(APPLICATION): $(APPLICATION).c $(SUPPLEMENTARY) $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $(APPLICATION) $(APPLICATION).c $(OBJS)

.c.o:
	$(CC) $(CFLAGS) -c -o $@ $<

.s.o:
	$(CC) $(CFLAGS) -c -o $@ $<

sig1:
	-/bin/kill -s SIGUSR1 `ps -A | grep testtask | awk '{print $$1}'`
	/bin/kill -s SIGUSR1 `ps -A | grep memcheck | awk '{print $$1}'`

sig2:
	-/bin/kill -s SIGUSR2 `ps -A | grep testtask | awk '{print $$1}'`
	/bin/kill -s SIGUSR2 `ps -A | grep memcheck | awk '{print $$1}'`

dump: $(APPLICATION)
	objdump -D $(APPLICATION) | less

debug: $(APPLICATION)
	gdb ./$(APPLICATION)
