# makefile for building 'make' and 'touch'

# first define some macros we will be using

MFILES	 = make.c makeinit.c makeread.c makemem.c maketime.c
MOBJECTS = make.o makeinit.o makeread.o makemem.o maketime.o

TFILES	 = touch.c
TOBJECTS = touch.o

CLIBES	 = -l0/a:c


# now describe how to make the files

# this builds the latest 'make'
make.com : $(MOBJECTS)
	ln -t -o $*.com $(MOBJECTS) $(CLIBES)
	sidsym $*.sym $*.sym

$(MOBJECTS) : $*.c make.h
	cc $*


# this builds the latest 'touch'
touch.com : $(TOBJECTS)
	ln -t -o $*.com $(TOBJECTS) $(CLIBES)
	sidsym $*.sym $*.sym

touch.o : $(TFILES)
	cc $*


# this will make both 'make' and 'touch'
all : touch.com make.com


# this will print only the changed sources
print : $(MFILES) $(TFILES)
	clist $?
	touch print


# this installs the updated version of 'make'
makeinstall :
	@user 0
	@set make.com [dir]
	@user 4
	@pip make.com[g0]=make.com
	@user 0
	@set make.com [sys]
	@user 4


# this installs the updated version of 'touch'Štouchinstall :
	@user 0
	@set touch.com [dir]
	@user 4
	@pip touch.com[g0]=touch.com
	@user 0
	@set touch.com [sys]
	@user 4
