Hi, all...
This patch adds more consistent handling of Makefile targets. First
of note, it handles object/ a bit better by forcing a 'make clean' of
the examples when necessary, and rebuilding stage2 if stage1 changes
(and stage1 if boot changes, and stage3 if stage2 changes).
It also introduces an '-exec' flag to idc:
-exec - execute a compiled program when idc is not installed
This flag is used to set the environment variables needed to run
idc-generated programs without installing the runtime to the system
directories. The usage is 'idc [-option ...] -exec PROGRAM [ARG]...',
and, specifically, it is sensitive to the -B flag.
Using -exec liberally in the Makefiles allows you to do 'make run'
from the toplevel directory and have the entire project build and all
the examples execute for your viewing pleasure without having to
install anything.
Search for '***' in the output to see if any errors happened.
Have fun,
--
Michael FIG <[EMAIL PROTECTED]> //\
http://michael.fig.org/ \//
Update Makefiles to be more friendly.
diff -r c25547efbe21 Makefile
--- a/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,33 +1,36 @@ SUBDIRS = object function
SUBDIRS = object function
all : .FORCE
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) ); done'
+
+run : .FORCE
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) run ); done'
dist : .FORCE
- $(SHELL) -ec '( cd dist; $(MAKE) dist )'
+ $(SHELL) -ec '( cd dist && $(MAKE) dist )'
install : .FORCE
- $(SHELL) -ec '( cd object; $(MAKE) install )'
+ $(SHELL) -ec '( cd object && $(MAKE) install )'
dist-src : .FORCE
- $(SHELL) -ec '( cd dist; $(MAKE) dist-src )'
+ $(SHELL) -ec '( cd dist && $(MAKE) dist-src )'
config : .FORCE
- $(SHELL) -ec '( cd object; $(MAKE) config )'
+ $(SHELL) -ec '( cd object && $(MAKE) config )'
win32 : .FORCE
$(MAKE) TARGET="i686-pc-mingw32"
tidy : .FORCE
rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) tidy ); done'
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) tidy ); done'
clean : .FORCE
rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) clean ); done'
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) clean ); done'
distclean spotless : .FORCE
-rm -f *~
- -$(SHELL) -c 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) distclean ); done'
+ -$(SHELL) -c 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) distclean ); done'
.FORCE :
diff -r c25547efbe21 function/Makefile
--- a/function/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,18 +1,21 @@ SUBDIRS = objects jolt-burg
SUBDIRS = objects jolt-burg
all : .FORCE
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) ); done'
tidy : .FORCE
rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) tidy ); done'
+ -$(SHELL) -ec 'for dir in $(SUBDIRS) examples; do ( cd $$dir && $(MAKE) tidy ); done'
clean : .FORCE
rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) clean ); done'
+ -$(SHELL) -ec 'for dir in $(SUBDIRS) examples; do ( cd $$dir && $(MAKE) clean ); done'
+
+run test : .FORCE
+ $(SHELL) -ec 'for dir in $(SUBDIRS) examples; do ( cd $$dir && $(MAKE) run ); done'
distclean spotless : .FORCE
rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) spotless ); done'
+ -$(SHELL) -ec 'for dir in $(SUBDIRS) examples; do ( cd $$dir && $(MAKE) spotless ); done'
.FORCE :
diff -r c25547efbe21 function/examples/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/function/examples/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -0,0 +1,21 @@
+SUBDIRS = cairo jcanvas libjolt peg prag-parse profile regexp select slotnames struct x-drawing x-event
+
+all : .FORCE
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) ); done'
+
+tidy : .FORCE
+ rm -f *~
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) tidy ); done'
+
+clean : .FORCE
+ rm -f *~
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) clean ); done'
+
+run test : .FORCE
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) run ); done'
+
+distclean spotless : .FORCE
+ rm -f *~
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) spotless ); done'
+
+.FORCE :
diff -r c25547efbe21 function/examples/cairo/Makefile
--- a/function/examples/cairo/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/cairo/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,11 +1,12 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
+IDC = ../idc
CAIROINC = $(patsubst %,-J%,$(wildcard /usr/include/cairo) $(wildcard /usr/local/include/cairo))
-test : cairolib.so .FORCE
- $(JOLT) boot.k main.k
+run test : cairolib.so .FORCE
+ $(IDC) -exec $(JOLT) boot.k main.k
cairolib.so : cairolib.st
- idc $(CAIROINC) -I../../objects -s $<
+ $(IDC) $(CAIROINC) -I../../objects -s $<
clean : .FORCE
rm -f *~ *.so *.o
diff -r c25547efbe21 function/examples/jcanvas/Makefile
--- a/function/examples/jcanvas/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/jcanvas/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,8 +1,8 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
CAIROINC = $(patsubst %,-J%,$(wildcard /usr/include/cairo) $(wildcard /usr/local/include/cairo))
-test : _cairo.so cairo.so .FORCE
- $(JOLT) boot.k main.k
+run test : _cairo.so cairo.so .FORCE
+ $(IDC) -exec $(JOLT) boot.k main.k
IDC = ../idc -O
IDFLAGS = -g -k -I../../objects $(CAIROINC)
diff -r c25547efbe21 function/examples/libjolt/Makefile
--- a/function/examples/libjolt/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/libjolt/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -17,10 +17,11 @@ JOLT_BOOT_FILES = boot.k quasiquote.k sy
JOLT_BOOT_FILES = boot.k quasiquote.k syntax.k number.k object.k
JOLT_BOOT_FILES := $(addprefix $(JOLT)/, $(JOLT_BOOT_FILES))
-all : jest$(OBJEXT)
+all : jest$(OBJEXT) test-libjolt$(OBJEXT)
-test : jest$(OBJEXT) .FORCE
- ./jest$(OBJEXT)
+run test : all .FORCE
+ $(IDC) -exec ./jest
+ $(IDC) -exec ./test-libjolt
.SUFFIXES :
@@ -75,7 +76,6 @@ install: libjolt.a
test-libjolt : libjolt.a .FORCE
gcc $(CPPFLAGS) -o $@ [EMAIL PROTECTED] $(LDFLAGS) libjolt.a $(LDLIBS)
- ./$@
jest : jest.c libjolt.a jolt.h
gcc $(CPPFLAGS) -o $@ [EMAIL PROTECTED] $(LDFLAGS) libjolt.a $(LDLIBS)
diff -r c25547efbe21 function/examples/peg/Makefile
--- a/function/examples/peg/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/peg/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,4 +1,5 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
+IDC = ../idc
all : peg.k
@@ -7,10 +8,10 @@ peg.k :
$(JOLT) boot.k peg.peg.k -o peg.k peg.peg
diff peg.peg.k peg.k
-test : basic.peg.k
- $(JOLT) boot.k basic.peg.k examples/test.bas
-# $(JOLT) boot.k basic.peg.k examples/fibonacci.bas
- $(JOLT) boot.k basic.peg.k examples/bench.bas
+run test : basic.peg.k
+ $(IDC) -exec $(JOLT) boot.k basic.peg.k examples/test.bas
+# $(IDC) -exec $(JOLT) boot.k basic.peg.k examples/fibonacci.bas
+ $(IDC) -exec $(JOLT) boot.k basic.peg.k examples/bench.bas
basic.peg.k : peg.k examples/basic.peg
$(JOLT) boot.k peg.k -o basic.peg.k examples/basic.peg
diff -r c25547efbe21 function/examples/select/Makefile
--- a/function/examples/select/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/select/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,7 +1,8 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
+IDC = ../idc
test : .FORCE
- $(JOLT) boot.k main.k
+ $(IDC) -exec $(JOLT) boot.k main.k
clean : .FORCE
rm -f *~
diff -r c25547efbe21 function/examples/struct/Makefile
--- a/function/examples/struct/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/struct/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -3,6 +3,8 @@ LIB = X11-Xlib.h
LIB = X11-Xlib.h
all : $(LIB).k
+
+run test : all
$(LIB).k : $(LIB).k-gen.c
cc -o [EMAIL PROTECTED] $<
diff -r c25547efbe21 function/examples/x-drawing/Makefile
--- a/function/examples/x-drawing/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/x-drawing/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,7 +1,8 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
+IDC = ../idc
-test : .FORCE
- $(JOLT) boot.k canvas.k
+run test : .FORCE
+ $(IDC) -exec $(JOLT) boot.k canvas.k
clean : .FORCE
rm -f *~
diff -r c25547efbe21 function/examples/x-event/Makefile
--- a/function/examples/x-event/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/examples/x-event/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,7 +1,8 @@ JOLT = ../../jolt-burg/main
JOLT = ../../jolt-burg/main
+IDC = ../idc
-test : .FORCE
- $(JOLT) boot.k x-event.k
+run test : .FORCE
+ $(IDC) -exec $(JOLT) boot.k x-event.k
clean : .FORCE
rm -f *~
diff -r c25547efbe21 function/jolt-burg/Makefile
--- a/function/jolt-burg/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/jolt-burg/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -27,7 +27,9 @@ all : main$(OBJEXT)
all : main$(OBJEXT)
test : main$(OBJEXT) .FORCE
- ./main$(OBJEXT) boot.k sanaras.k
+ $(IDC) -exec ./main$(OBJEXT) boot.k sanaras.k
+
+run : test .FORCE
.SUFFIXES :
diff -r c25547efbe21 function/objects/Makefile
--- a/function/objects/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/function/objects/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -19,6 +19,9 @@ all : objects.a
test : objects.a test.st
$(IDC) $(IDFLAGS) test.st objects.a -lreadline
+
+run : test
+ $(IDC) -exec ./test
.SUFFIXES :
diff -r c25547efbe21 object/Makefile
--- a/object/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -11,31 +11,31 @@ boot : .config-stamp .FORCE
stage1 : .FORCE
-$(SHELL) -ec '[ -d stage1 ] || mkdir stage1'
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir; $(MAKE) IDC="../boot/idc -B../boot/ -O" BIN="../stage1/" ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir && $(MAKE) IDC="../boot/idc -B../boot/ -O -Wc,-DSTAGE1=1" BIN="../stage1/" DEP="../boot/idc1 ../boot/include/id/id.h" PROGDEP="../boot/libid.o" ) || exit $$?; done'
stage2 : .FORCE
-$(SHELL) -ec '[ -d stage2 ] || mkdir stage2'
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir; $(MAKE) IDC="../stage1/idc -B../stage1/ -O" BIN="../stage2/" ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir && $(MAKE) IDC="../stage1/idc -B../stage1/ -O" BIN="../stage2/" DEP="../stage1/idc1 ../stage1/include/id/id.h" PROGDEP="../stage1/libid.o" ) || exit $$?; done'
stage3 : .FORCE
-$(SHELL) -ec '[ -d stage3 ] || mkdir stage3'
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir; $(MAKE) IDC="../stage2/idc -B../stage2/ -g" BIN="../stage3/" ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( echo $$dir; cd $$dir && $(MAKE) IDC="../stage2/idc -B../stage2/ -g" BIN="../stage3/" DEP="../stage2/idc1 ../stage2/include/id/id.h" PROGDEP="../stage2/libid_g.o" ) || exit $$?; done'
test2 : stage2 .FORCE
- -$(SHELL) -ec '( cd examples/hw; make clean; ../../stage2/idc -B../../stage2/ -I../../st80 -g -k hw.st; LD_LIBRARY_PATH=../../stage2 ./hw )'
+ -$(SHELL) -ec '( IDC_STAGE=stage2; export IDC_STAGE; cd examples/hw && $(MAKE) clean && $(MAKE) run )'
test3 : stage3 .FORCE
- -$(SHELL) -ec '( cd examples/hw; make clean; ../../stage3/idc -B../../stage3/ -I../../st80 -g -k hw.st; LD_LIBRARY_PATH=../../stage3 ./hw )'
+ -$(SHELL) -ec '( IDC_STAGE=stage3; export IDC_STAGE; cd examples/hw && $(MAKE) clean && $(MAKE) run )'
rebuild : .FORCE
rm -rf stage*/include stage*/idc1
$(MAKE)
install : all .FORCE
- $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) IDC="../stage1/idc -B../stage1/ -O" BIN="../stage2/" install ); done'
+ $(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) IDC="../stage1/idc -B../stage1/ -O" BIN="../stage2/" install ) || exit $$?; done'
install-boot : boot .FORCE
- $(SHELL) -ec '( cd boot; $(MAKE) install )'
+ $(SHELL) -ec '( cd boot && $(MAKE) install )'
win32 : .FORCE
$(MAKE) TARGET="i686-pc-mingw32"
@@ -46,10 +46,10 @@ newboot : all .FORCE
cp -p id/*.h boot/include/id/.
dist : .config-stamp .FORCE
- $(SHELL) -ec '( cd dist; $(MAKE) dist )'
+ $(SHELL) -ec '( cd dist && $(MAKE) dist )'
dist-src : .config-stamp .FORCE
- $(SHELL) -ec '( cd dist; $(MAKE) dist-src )'
+ $(SHELL) -ec '( cd dist && $(MAKE) dist-src )'
.config-stamp : boot/configure */*.in
./boot/configure $(TARGET) $(PREFIX) $(CONFIG) && touch .config-stamp
@@ -59,9 +59,9 @@ config : .FORCE
./boot/configure $(TARGET) $(PREFIX) $(CONFIG) && touch .config-stamp
cp -p idc/idc boot/.
-test : all .FORCE
- $(SHELL) -ec '( cd test; $(MAKE) run )'
- $(SHELL) -ec '( cd st80; $(MAKE) run )'
+run test : all .FORCE
+ $(SHELL) -ec '( cd examples && $(MAKE) run )'
+#$(SHELL) -ec '( cd st80 && $(MAKE) run )'
tidy : .config-stamp .FORCE
rm -f *~
@@ -76,7 +76,7 @@ clean3 : .FORCE
distclean spotless : .config-stamp .FORCE
-rm -f *~ .config-stamp
- -$(SHELL) -c 'for dir in boot $(SUBDIRS) examples; do ( cd $$dir; $(MAKE) clean distclean ); done'
+ -$(SHELL) -c 'for dir in boot $(SUBDIRS) examples; do ( cd $$dir && $(MAKE) clean distclean ); done'
-$(SHELL) -c 'for dir in stage1 stage2 stage3; do rm -rf $$dir; done'
.FORCE :
diff -r c25547efbe21 object/examples/00_README
--- a/object/examples/00_README Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/00_README Thu Dec 06 06:24:58 2007 -0600
@@ -1,20 +1,5 @@ NOTE: These examples will only work if t
-NOTE: These examples will only work if the 'idc' compiler has been
-installed. To compile them without installing you will have to:
-
- - point the Makefiles at the uninstalled 'idc' by setting the
- variable IDC on the command line;
-
- - tell 'idc' where to find its own compiled runtime libraries with
- -the B option; and
-
- - tell 'idc' where to find the compile-time st80 libraries with the
- -I option
-
-like this:
-
- cd hw
- make IDC="../../../boot/idc -B../../../boot/ -I../../st80"
- LD_LIBRARY_PATH=$PWD/../../../boot ./hw
+NOTE: These examples will only work if you run them with 'make run' or
+the stage2 'idc' compiler has been installed.
NOTE: Compilation can be long on slow hardware because many of the
examples import 'st80' causing the compiler to scan the source of the
diff -r c25547efbe21 object/examples/Makefile
--- a/object/examples/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -1,21 +1,24 @@ SUBDIRS = avl dispatch echo forward hw i
-SUBDIRS = avl dispatch echo forward hw ignore interp libs1 libs2 libs3 parse prototype reflect serialise slots sqvm system this traits typename weak x11
+SUBDIRS = avl dispatch echo forward hw ignore interp libs1 libs2 libs3 parse \
+ prototype reflect serialise slots sqvm system this traits typename weak x11
all : .FORCE
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) ); done'
+ test ! -f ../stage2/clean-examples || $(MAKE) clean
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) ); done'
run : .FORCE
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) run ); done'
+ test ! -f ../stage2/clean-examples || $(MAKE) clean
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) run ); done'
tidy : .FORCE
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) tidy ); done'
- rm -f *~
+ rm -f *~ ../boot/clean-examples ../stage*/clean-examples
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) tidy ); done'
clean : .FORCE
- rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) clean ); done'
+ rm -f *~ ../boot/clean-examples ../stage*/clean-examples
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) clean ); done'
distclean spotless : .FORCE
- rm -f *~
- -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir; $(MAKE) spotless ); done'
+ rm -f *~ ../boot/clean-examples ../stage*/clean-examples
+ -$(SHELL) -ec 'for dir in $(SUBDIRS); do ( cd $$dir && $(MAKE) spotless ); done'
.FORCE :
diff -r c25547efbe21 object/examples/avl/Makefile
--- a/object/examples/avl/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/avl/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
%.so : %.st
$(IDC) -s $<
diff -r c25547efbe21 object/examples/dispatch/Makefile
--- a/object/examples/dispatch/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/dispatch/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/echo/Makefile
--- a/object/examples/echo/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/echo/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM) hello world
+ $(IDC) -exec ./$(PROGRAM) hello world
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/forward/Makefile
--- a/object/examples/forward/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/forward/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/hw/Makefile
--- a/object/examples/hw/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/hw/Makefile Thu Dec 06 06:24:58 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/idc
--- a/object/examples/idc Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/idc Thu Dec 06 06:24:58 2007 -0600
@@ -1,7 +1,9 @@
#!/bin/sh
-if test -x ../../stage2/idc; then
- exec ../../stage2/idc -B ../../stage2/ -I../../st80 $*
+IDC_STAGE=${IDC_STAGE-stage2}
+
+if test -x ../../$IDC_STAGE/idc; then
+ exec ../../$IDC_STAGE/idc -B ../../stage2/ -I../../st80 $*
else
exec idc $*
fi
diff -r c25547efbe21 object/examples/ignore/Makefile
--- a/object/examples/ignore/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/ignore/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- -./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM) || :
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/interp/Makefile
--- a/object/examples/interp/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/interp/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/libs1/Makefile
--- a/object/examples/libs1/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/libs1/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
main : main.st libs.a
$(IDC) main.st libs.a
diff -r c25547efbe21 object/examples/libs2/Makefile
--- a/object/examples/libs2/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/libs2/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -6,7 +6,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./main
+ $(IDC) -exec ./main
%.so : %.st
$(IDC) -s $<
diff -r c25547efbe21 object/examples/libs3/Makefile
--- a/object/examples/libs3/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/libs3/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
main : main.st libs.so
$(IDC) main.st
diff -r c25547efbe21 object/examples/parse/Makefile
--- a/object/examples/parse/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/parse/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/prototype/Makefile
--- a/object/examples/prototype/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/prototype/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/reflect/Makefile
--- a/object/examples/reflect/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/reflect/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -22,7 +22,7 @@ all : $(SHOBJS) $(LDOBJS) $(PROGRAM)
$(IDC) $< $(LDOBJS) $(LDLIBS)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
stats : .FORCE
sort -u $(LDOBJS:$o=.st) | wc -l
diff -r c25547efbe21 object/examples/serialise/Makefile
--- a/object/examples/serialise/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/serialise/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -22,7 +22,7 @@ all : $(SHOBJS) $(LDOBJS) $(PROGRAM)
$(IDC) $< $(LDOBJS) $(LDLIBS)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
stats : .FORCE
sort -u $(LDOBJS:$o=.st) | wc -l
diff -r c25547efbe21 object/examples/slots/Makefile
--- a/object/examples/slots/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/slots/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -22,7 +22,7 @@ all : $(SHOBJS) $(LDOBJS) $(PROGRAM)
$(IDC) $< $(LDOBJS) $(LDLIBS)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
stats : .FORCE
sort -u $(LDOBJS:$o=.st) | wc -l
diff -r c25547efbe21 object/examples/sqvm/Makefile
--- a/object/examples/sqvm/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/sqvm/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -34,7 +34,7 @@ SqueakBitBlt.o : SqueakBitBlt.st BitBltP
$(IDC) $< $(LDOBJS) $(LDLIBS)
run : all
- ./main mini.image
+ $(IDC) -exec ./main mini.image
io-test : io-test.c
$(CC) io-test.c -L/usr/X11R6/lib -lX11 -lm -o io-test
diff -r c25547efbe21 object/examples/system/Makefile
--- a/object/examples/system/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/system/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,8 +5,8 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./system1 ls
- ./system2 pwd
+ $(IDC) -exec ./system1 ls
+ $(IDC) -exec ./system2 pwd
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/this/Makefile
--- a/object/examples/this/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/this/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/traits/Makefile
--- a/object/examples/traits/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/traits/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,8 +5,8 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./simple
- ./complex
+ $(IDC) -exec ./simple
+ $(IDC) -exec ./complex
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/typename/Makefile
--- a/object/examples/typename/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/typename/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -5,7 +5,7 @@ all : $(PROGRAM)
all : $(PROGRAM)
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
% : %.st
$(IDC) $<
diff -r c25547efbe21 object/examples/weak/Makefile
--- a/object/examples/weak/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/weak/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -8,7 +8,7 @@ all : $(PROGRAM)
$(IDC) $<
run : all
- ./$(PROGRAM)
+ $(IDC) -exec ./$(PROGRAM)
tidy: .FORCE
rm -f *~
diff -r c25547efbe21 object/examples/x11/Makefile
--- a/object/examples/x11/Makefile Thu Dec 06 06:22:48 2007 -0600
+++ b/object/examples/x11/Makefile Thu Dec 06 06:24:59 2007 -0600
@@ -6,7 +6,7 @@ all : $(LIBS) $(PROGRAM)
all : $(LIBS) $(PROGRAM)
run : all
- ./main
+ $(IDC) -exec ./main
%.so : %.st
$(IDC) -J/usr/X11R6/include -s $< -L/usr/X11R6/lib -lX11
diff -r c25547efbe21 object/idc/Makefile.in
--- a/object/idc/Makefile.in Thu Dec 06 06:22:48 2007 -0600
+++ b/object/idc/Makefile.in Thu Dec 06 06:24:59 2007 -0600
@@ -56,19 +56,20 @@ OBJEXT_SO = @OBJEXT_SO@
all : $(BIN)gc.a $(BIN)idst$(OBJEXT_SO) $(BIN)idc1$(OBJEXT) $(BIN)idc
-$(BIN)idst$(OBJEXT_SO) : idst.st $(FILES)
+$(BIN)idst$(OBJEXT_SO) : idst.st $(FILES) $(DEP)
$(IDC) $(IINC) $(IDFLAGS) -s idst.st $(FILES) -o $@
.SUFFIXES :
-$(BIN)%$(OBJEXT_SO) : %.st
+$(BIN)%$(OBJEXT_SO) : %.st $(DEP)
$(IDC) $(IINC) $(IDFLAGS) -s $< -o $@
-$(BIN)%$(OBJEXT_O) : %.st
+$(BIN)%$(OBJEXT_O) : %.st $(DEP)
$(IDC) $(IINC) $(IDFLAGS) -c $< -o $@
-$(BIN)%$(OBJEXT) : %.st
+$(BIN)%$(OBJEXT) : %.st $(DEP) $(PROGDEP)
$(IDC) $(IINC) $(IDFLAGS) $< -o $@
+ echo timestamp > $(BIN)clean-examples
$(BIN)idc : ../idc/idc
-$(SHELL) -ec 'cp -p $< $@'
diff -r c25547efbe21 object/idc/idc.in
--- a/object/idc/idc.in Thu Dec 06 06:22:48 2007 -0600
+++ b/object/idc/idc.in Thu Dec 06 06:24:59 2007 -0600
@@ -14,6 +14,7 @@ idtype="program"
idtype="program"
idmain="false"
cckill="true"
+exec="false"
_p=""
fatal () {
@@ -59,6 +60,7 @@ usage: $program [-option ...] filename
-C arch - print configured architecture
-C os - print configured operating system
-c - generate an object file
+ -exec - execute a compiled program when idc is not installed
-g - generate debugging information
-h - print help (this message) then exit
-H - print copyright information then exit
@@ -91,6 +93,7 @@ while [ $# -gt 0 ]; do
-C?*) config="${1#-C}";;
-C) checkarg $@; config="$2"; shift;;
-c) idtype="object";;
+ -exec) exec=true; shift; break;;
-f*) ccopts="$ccopts $1";;
-g*) ccopts="$ccopts -g -DID_DEBUG=1"; idopts="$idopts -g"; _p="_g";;
-I?*) idopts="$idopts -I${1#-I}";;
@@ -200,36 +203,39 @@ case $idtype in
;;
esac
-if test -s .id.ldobjs; then
+if $exec; then : # Do nothing if we are asked to execute the command line.
+else
+ if test -s .id.ldobjs; then
while read file; do
- ldobjs="$ldobjs `nm $file | fgrep __id__init__ | awk '{print \"-u\", $3}'`"
+ ldobjs="$ldobjs `nm $file | fgrep __id__init__ | awk '{print \"-u\", $3}'`"
done < .id.ldobjs
-fi
-rm -f .id.ldobjs
-
-$idmain && idflags="-m"
-
-if [ -z "$infile" ]; then
- [ -z "$outfile" ] && fatal "no output file specified"
-else
- [ -z "$outfile" ] && outfile=${infile%.st}$soext
- [ "$infile" = "$outfile" ] && fatal "input and output files are the same"
- ccfile="${outfile}.c"
-fi
-
-if $cckill; then
- cckill="rm -f"
-else
- cckill="true"
-fi
-
-trap "$run $cckill $ccfile; exit 1" 2 3 5 6 10 13 15
-
-for lib in $idlibs; do
- plibs="${plibs} ${prefix}${lib}"
-done
-idlibs="$plibs"
-ccflags="$ccflags -I${prefix}"
+ fi
+ rm -f .id.ldobjs
+
+ $idmain && idflags="-m"
+
+ if [ -z "$infile" ]; then
+ [ -z "$outfile" ] && fatal "no output file specified"
+ else
+ [ -z "$outfile" ] && outfile=${infile%.st}$soext
+ [ "$infile" = "$outfile" ] && fatal "input and output files are the same"
+ ccfile="${outfile}.c"
+ fi
+
+ if $cckill; then
+ cckill="rm -f"
+ else
+ cckill="true"
+ fi
+
+ trap "$run $cckill $ccfile; exit 1" 2 3 5 6 10 13 15
+
+ for lib in $idlibs; do
+ plibs="${plibs} ${prefix}${lib}"
+ done
+ idlibs="$plibs"
+ ccflags="$ccflags -I${prefix}"
+fi
[ -z "$prefix" ] || {
libfix=${prefix}
@@ -242,6 +248,12 @@ ccflags="$ccflags -I${prefix}"
export IDC_LIBDIR
}
+if $exec; then
+ # We've already set up the environment, so go ahead.
+ exec ${1+"$@"}
+ exit $?
+fi
+
if [ ! -z "$infile" ]; then
$verbose
$run ${prefix}idc1 -I$prefix $idopts $idflags $infile -o $ccfile &&
diff -r c25547efbe21 object/st80/Makefile.in
--- a/object/st80/Makefile.in Thu Dec 06 06:22:48 2007 -0600
+++ b/object/st80/Makefile.in Thu Dec 06 06:24:59 2007 -0600
@@ -57,13 +57,13 @@ run : $(BIN)st80.so $(BIN)test-st80
.SUFFIXES :
-$(BIN)%$(OBJEXT_SO) : %.st
+$(BIN)%$(OBJEXT_SO) : %.st $(DEP)
$(IDC) $(IINC) $(IDFLAGS) -s $< -o $@
-$(BIN)%$(OBJEXT_O) : %.st
+$(BIN)%$(OBJEXT_O) : %.st $(DEP)
$(IDC) $(IINC) $(IDFLAGS) -c $< -o $@
-$(BIN)%$(OBJEXT) : %.st
+$(BIN)%$(OBJEXT) : %.st $(DEP)
$(IDC) $(IINC) $(IDFLAGS) $< -o $@
install : all .FORCE
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc