OPT= -opt 4 -cpu 3000 -exp

# if you change the following name, you have to change it in the source!
PIO=lapr

all: install

install: $(PIO) /dev/$(PIO)
	/com/intm $(PIO) -r -l

/dev/$(PIO): $(PIO)
	-test ! -f /dev/$(PIO) \
            && ( touch /dev/$(PIO) ; /com/obty /dev/$(PIO) $(PIO) )

#/dev/$(PIO): $(PIO)_mgr
#	/com/dlf /dev/$(PIO) && echo /dev/$(PIO) 'gel"oscht'
#	echo "create -no_pre_exist /dev/$(PIO) $(PIO)" | ./$(PIO)_mgr -init
#	echo ' '
#
#$(PIO)_mgr: $(PIO).bin $(PIO)_uid.bin
#	/com/bind /com/ios_test $(PIO).bin $(PIO)_uid.bin /sys/traits/io_traits -b $(PIO)_mgr

$(PIO):$(PIO).bin $(PIO)_uid.bin
	/com/bind -b $(PIO) $(PIO).bin $(PIO)_uid.bin /sys/traits/io_traits.3 -loadhigh -entry 'ios_$$initialize'

$(PIO).bin: $(PIO).c
	/com/cc $(PIO).c -cpu 3000 -opt 4 -pic

$(PIO).c: io.c
	sed s/hhu_centr/$(PIO)/ <io.c >$(PIO).c

$(PIO)_uid.bin:
#	Ist der Typ noch nicht vorhanden, wird er erst erzeugt :
#	echo 'if the following line fails, use :' >/dev/null
	-crty $(PIO) 
	/com/crtyobj $(PIO)
	echo ' ' 
        
clean :
	-rm *.bak *.lst
	ls -lT * /dev/$(PIO)

print:
	/usr/local/bin/a2ps README Makefile io.c Install Delete
