head	1.4;
access;
symbols
	start:1.1.1.1 webdox:1.1.1;
locks; strict;
comment	@# @;


1.4
date	2003.03.17.01.26.34;	author redpain;	state Exp;
branches;
next	1.3;

1.3
date	2003.03.17.01.23.22;	author redpain;	state Exp;
branches;
next	1.2;

1.2
date	2003.03.17.01.07.41;	author redpain;	state Exp;
branches;
next	1.1;

1.1
date	2003.03.15.00.57.45;	author redpain;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2003.03.15.00.57.45;	author redpain;	state Exp;
branches;
next	;


desc
@@


1.4
log
@mash.c -> kmsh.c
@
text
@# Makefile for user programs used for testing
# $Revision: 1.3 $

#CC_PREFIX = i386-elf-
CC = $(CC_PREFIX)gcc
CFLAGS = -Wall
LD = $(CC_PREFIX)ld
OBJCOPY = $(CC_PREFIX)objcopy
RANLIB = $(CC_PREFIX)ranlib
MKUPROG = perl ../mkuprog

UPROGS = testkmsh.c testb.c

# FIXME: need better way to figure out unix vs. windows
ifeq ($(OS),Windows_NT)
ENTRY = __Entry
AWK = gawk
else
ENTRY = _Entry
AWK = awk
endif

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

%.exe : %.o libuser.a
	$(LD) -M -o $@@ -Ttext 0x0 -e $(ENTRY) $*.o libuser.a > $*.txt

%.bin : %.exe
	$(OBJCOPY) -R .dynamic -R .note -R .comment -S -O binary \
		$*.exe $*.bin

test%.c : %.bin
	$(MKUPROG) $< $* `egrep '.*0x.*_Entry' $*.txt | $(AWK) '{print $$1}'` > test$*.c

../uprogs.c : $(UPROGS)
	echo '#include "user.h"' > $@@
	cat $(UPROGS) >> $@@
	echo "const struct User_Program* g_userProgramTable[] = {" >> $@@
	egrep "^const struct User_Program" $(UPROGS) | $(AWK) '{print "&", $$4, ","}' >> $@@
	echo "};" >> $@@
	echo "const unsigned g_numUserPrograms = sizeof(g_userProgramTable)/sizeof(struct User_Program*);" >> $@@

# Library of user mode routines and syscall wrappers;
# essentially a very simple libc.
libuser.a : libuser.o ../string.o
	ar ruv $@@ libuser.o ../string.o
	$(RANLIB) $@@ || true

../string.o : dummy
	cd .. && $(MAKE) string.o

dummy :

clean :
	rm -f *.o *.a *.bin *.txt $(UPROGS)
@


1.3
log
@a.c -> mash.c
@
text
@d2 1
a2 1
# $Revision: 1.2 $
d12 1
a12 1
UPROGS = testmash.c testb.c
@


1.2
log
@in clean, rm a.txt b.txt
@
text
@d2 1
a2 1
# $Revision: 1.1.1.1 $
d12 1
a12 1
UPROGS = testa.c testb.c
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
# $Revision: 1.10 $
d56 1
a56 1
	rm -f *.o *.a *.bin $(UPROGS)
@


1.1.1.1
log
@Project Start
@
text
@@
