# .COPYRIGHT:	Copyright (c) 1988-2006 European Southern Observatory,
#						all rights reserved
# .TYPE		make file
# .NAME		$MIDASHOME/$MIDVERS/test/os/makefile 
# .LANGUAGE	makefile syntax
# .ENVIRONMENT	Unix Systems. 
# .COMMENT	Compiles source files and generates "os" test commands
#
# .REMARKS	
# .AUTHOR	Carlos Guirao
# .VERSION 1.1	880831:		Implementation
# .VERSION 3.0  930308:		Using default.mk file
# 061108	last modif
# 

include ../../local/default.mk

DEBUG = -g
ARFLAGS = dv
STRIP = echo

LLIB = -L$(LIBDIR) -los
RLIB = libros.a


OUT =	osptest.exe osatest.exe osdtest.exe osftest.exe oshtest.exe \
	osutest.exe osttest.exe \
	oschild.exe \
	atestosu.exe testosu.exe ospsystem.exe \
	atestosx.exe testosx.exe 

OBJ =	osptest.o osatest.o osdtest.o osftest.o oshtest.o osttest.o \
	osetest.o osmtest.o atestosu.o testosu.o testtape.o ospsystem.o	

OSHEADER = $(INC)/osparms.h 

# DEPENDENCIES:
all: $(OUT)

$(RLIB): $(LIBDIR)/libos.a
	cp $(LIBDIR)/libos.a $(RLIB)
	$(AR) $(ARFLAGS) $(RLIB) osu.o
	$(RANLIB) $(RLIB)


atestosx.exe: atestosx.o $(LIBDIR)/libos.a
	$(LDCC) atestosx.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
testosx.exe: testosx.o $(LIBDIR)/libos.a
	$(LDCC) testosx.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
atestosu.exe: atestosu.o $(LIBDIR)/libos.a
	$(LDCC) atestosu.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
testosu.exe: testosu.o $(LIBDIR)/libos.a
	$(LDCC) testosu.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osutest.exe: osutest.o $(LIBDIR)/libos.a
	$(LDCC) osutest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
testtape.exe: testtape.o $(RLIB) 
	$(LDCC) testtape.o $(RLIB) $(SLIB) -o $@
	$(STRIP) $@
osptest.exe: osptest.o $(LIBDIR)/libos.a
	$(LDCC) osptest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
oschild.exe: oschild.o $(LIBDIR)/libos.a
	$(LDCC) oschild.o $(SLIB) -o $@
	$(STRIP) $@
osatest.exe: osatest.o $(LIBDIR)/libos.a
	$(LDCC) osatest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osdtest.exe: osdtest.o $(LIBDIR)/libos.a
	$(LDCC) osdtest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osftest.exe: osftest.o $(LIBDIR)/libos.a
	$(LDCC) osftest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
oshtest.exe: oshtest.o $(LIBDIR)/libos.a
	$(LDCC) oshtest.o $(LLIB) -o $@
	$(STRIP) $@
osttest.exe: osttest.o $(LIBDIR)/libos.a
	$(LDCC) osttest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osetest.exe: osetest.o $(LIBDIR)/libos.a
	$(LDCC) osetest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
#	echo "clear ipc-semaphores and run osetest"
osetest1.exe: osetest1.o $(LIBDIR)/libos.a
	$(LDCC) osetest1.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osmtest.exe: osmtest.o $(LIBDIR)/libos.a
	$(LDCC) osmtest.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
osmtest1.exe: osmtest1.o $(LIBDIR)/libos.a
	$(LDCC) osmtest1.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
ospsystem.exe: ospsystem.o $(LIBDIR)/libos.a
	$(LDCC) ospsystem.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(OBJ): $(OSHEADER)

run:
	./osmtest.exe
	./osptest.exe
	./osatest.exe
	./osdtest.exe
	./osftest.exe
	./osetest.exe
	./oshtest.exe
	./osttest.exe

clean:
	rm -f *.o

clean_exec:
	rm -f *.exe
