[m-dev.] for review: fix problems with .par and libgc
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Aug 17 02:00:10 AEST 2000
Tyson, could you please review this one?
Note that this change is not yet complete! See XXX below.
But it would probably benefit from being reviewed now.
Peter Ross, could you please review the changes to NT_MAKEFILE?
I didn't really understand what the `d' in `libgcd*.dll' was there for.
----------
Estimated hours taken: 3
Support installing both `.par' and non-`.par' versions of the GC library.
scripts/ml.in:
Change the code for computing which version of the GC library
to link in so that it also takes the `.par' grade component
into account, rather than just the `.prof' grade component.
Add new options `--print-gc-grade' (for use by the top-level
Mmakefile) and `--print-grade' (for symmetry).
Mmakefile:
When invoking sub-makes in the boehm_gc directory,
pass down GC_GRADE instead of PROF.
Compute the GC_GRADE value using `scripts/ml ... --print-gc-grade`
rather than computing it manually, since this avoids code duplication.
boehm_gc/Mmakefile:
boehm_gc/Makefile:
boehm_gc/NT_MAKEFILE:
s/gc$(PROF)/$(GC_GRADE)/g
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
runtime/Mmakefile:
XXX These still need to be fixed.
Workspace: /home/pgrad/fjh/ws/hg
Index: boehm_gc/Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile,v
retrieving revision 1.40
diff -u -d -r1.40 Makefile
--- boehm_gc/Makefile 1999/09/17 06:07:11 1.40
+++ boehm_gc/Makefile 2000/08/16 14:06:44
@@ -247,10 +247,10 @@
mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
# Mercury-specific target:
-libgc$(PROF)$(DLL_DEF_LIB).a: gc.a
- rm -f libgc$(PROF)$(DLL_DEF_LIB).a
+lib$(GC_GRADE)$(DLL_DEF_LIB).a: gc.a
+ rm -f lib$(GC_GRADE)$(DLL_DEF_LIB).a
# `ln -s' here doesn't work with gnu-win32, so we use `cp' instead
- cp gc.a libgc$(PROF)$(DLL_DEF_LIB).a
+ cp gc.a lib$(GC_GRADE)$(DLL_DEF_LIB).a
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
echo > base_lib
@@ -297,16 +297,16 @@
# Mercury-specific target:
# generic shared library version of the collector
-libgc$(PROF).so: $(OBJS) $(UTILS) # dyn_load_sunos53.o
+lib$(GC_GRADE).so: $(OBJS) $(UTILS) # dyn_load_sunos53.o
rm -f on_sparc_sunos5_so
./if_mach SPARC SUNOS5 touch on_sparc_sunos5_so
./if_mach SPARC SUNOS5 $(MAKE) dyn_load_sunos53.o
./if_mach SPARC SUNOS5 \
- $(LINK_SHARED_OBJ) -o libgc$(PROF).so $(OBJS) dyn_load_sunos53.o \
+ $(LINK_SHARED_OBJ) -o lib$(GC_GRADE).so $(OBJS) dyn_load_sunos53.o \
-ldl `./threadlibs`
./if_not_there on_sparc_sunos5_so $(MAKE) dyn_load.o
./if_not_there on_sparc_sunos5_so \
- $(LINK_SHARED_OBJ) -o libgc$(PROF).so $(OBJS) dyn_load.o -lc
+ $(LINK_SHARED_OBJ) -o lib$(GC_GRADE).so $(OBJS) dyn_load.o -lc
# SunOS5 shared library version of the collector
@@ -489,10 +489,10 @@
# so we need targets `a', `so', and `dll'.
.PHONY: a
-a: libgc$(PROF).a
+a: lib$(GC_GRADE).a
.PHONY: so
-so: libgc$(PROF).so
+so: lib$(GC_GRADE).so
#-----------------------------------------------------------------------------#
# support for DLLs using gnu-win32
@@ -509,7 +509,7 @@
@echo Made DLL
# GNU Make seems to need these extra dependencies as a hint
-libgc$(PROF).dll: libgc$(PROF)$(DLL_DEF_LIB) libgc.def
+lib$(GC_GRADE).dll: lib$(GC_GRADE)$(DLL_DEF_LIB) libgc.def
test_dll.o: test.c libgc_dll.h libgc_globals.h
$(CC) $(CFLAGS) -UGC_DEFINE_DLL -c test.c -o test_dll.o
Index: boehm_gc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Mmakefile,v
retrieving revision 1.11
diff -u -d -r1.11 Mmakefile
--- boehm_gc/Mmakefile 2000/06/08 13:06:41 1.11
+++ boehm_gc/Mmakefile 2000/08/16 15:33:29
@@ -6,22 +6,25 @@
# Mmake - Mmake file for Hans Boehm's conservative garbage collector.
-PROF=
-MAIN_TARGET=libgc$(PROF)
+# The invoker is expected to set GC_GRADE on the command line
+# in cases when this default is not appropriate.
+GC_GRADE=gc
+
+MAIN_TARGET=lib$(GC_GRADE)
MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common
#-----------------------------------------------------------------------------#
-.PHONY: libgc$(PROF)
-libgc$(PROF): submake
+.PHONY: lib$(GC_GRADE)
+lib$(GC_GRADE): submake
-libgc$(PROF).$A: submake
+lib$(GC_GRADE).$A: submake
-libgc$(PROF).so: submake
+lib$(GC_GRADE).so: submake
-libgc$(PROF).dll: submake
+lib$(GC_GRADE).dll: submake
MMAKEFLAGS=
@@ -31,8 +34,9 @@
# We don't use `unset', since the Ultrix /bin/sh doesn't have `unset'.
submake: force
MAKEFLAGS=""; export MAKEFLAGS; \
- $(MAKE) $(BOEHMGC_MAKEFILE) $(MMAKEFLAGS) GRADE=$(GRADE) PROF=$(PROF) \
- libgc$(PROF).$A libgc$(PROF).$(EXT_FOR_SHARED_LIB) \
+ $(MAKE) $(BOEHMGC_MAKEFILE) $(MMAKEFLAGS) GRADE=$(GRADE) \
+ GC_GRADE=$(GC_GRADE) \
+ lib$(GC_GRADE).$A lib$(GC_GRADE).$(EXT_FOR_SHARED_LIB) \
$(EXT_FOR_SHARED_LIB)
.PHONY: force
@@ -85,8 +89,8 @@
cp $(PRIVATE_HEADERS) $(INSTALL_INC_DIR)/private
.PHONY: install_lib
-install_lib: libgc$(PROF).$A libgc$(PROF).$(EXT_FOR_SHARED_LIB) install_dirs
- cp `vpath_find libgc$(PROF).$A libgc$(PROF).$(EXT_FOR_SHARED_LIB)` \
- $(INSTALL_MERC_GC_LIB_DIR) \
+install_lib: lib$(GC_GRADE).$A lib$(GC_GRADE).$(EXT_FOR_SHARED_LIB) install_dirs
+ cp `vpath_find lib$(GC_GRADE).$A lib$(GC_GRADE).$(EXT_FOR_SHARED_LIB)` \
+ $(INSTALL_MERC_GC_LIB_DIR)
#-----------------------------------------------------------------------------#
Index: boehm_gc/NT_MAKEFILE
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/NT_MAKEFILE,v
retrieving revision 1.6
diff -u -d -r1.6 NT_MAKEFILE
--- boehm_gc/NT_MAKEFILE 2000/06/08 13:06:41 1.6
+++ boehm_gc/NT_MAKEFILE 2000/08/16 15:45:53
@@ -24,8 +24,8 @@
all: gctest.exe cord\de.exe test_cpp.exe
-dll: libgcd$(PROF)$(DLL_DEF_LIB).dll
-libgc$(PROF)$(DLL_DEF_LIB).dll: libgcd.dll
+dll: lib$(GC_GRADE)d$(DLL_DEF_LIB).dll
+lib$(GC_GRADE)$(DLL_DEF_LIB).dll: libgcd.dll
# had -DSMALL_CONFIG
%.obj:%.c
$(cc) $(cdebug) $(CFLAGS) $(cvars) -DSILENT -DLARGE_CONFIG -DALL_INTERIOR_POINTERS -D__STDC__ /c /Fo$*.obj $*.c
@@ -38,16 +38,16 @@
gc.lib: $(OBJS)
lib /MACHINE:i386 /out:gc.lib $(OBJS)
# a .def defining exports should be made....
-libgcd$(PROF)$(DLL_DEF_LIB).dll: $(OBJS)
-# $(link) /MACHINE:i386 /DLL /out:libgcd.dll $(OBJS)
+lib$(GC_GRADE)d$(DLL_DEF_LIB).dll: $(OBJS)
+# $(link) /MACHINE:i386 /DLL /out:lib$(GC_GRADE)d.dll $(OBJS)
# The original NT SDK used lib32 instead of lib
-libgc$(PROF)$(DLL_DEF_LIB).lib: gc.lib
- rm -f libgc$(PROF)$(DLL_DEF_LIB).lib
+lib$(GC_GRADE)$(DLL_DEF_LIB).lib: gc.lib
+ rm -f lib$(GC_GRADE)$(DLL_DEF_LIB).lib
# `ln -s' here doesn't work with gnu-win32, so we use `cp' instead
- cp gc.lib libgc$(PROF)$(DLL_DEF_LIB).lib
+ cp gc.lib lib$(GC_GRADE)$(DLL_DEF_LIB).lib
gctest.exe: test.obj libgc.lib
# The following works for win32 debugging. For win32s debugging use debugtype:coff
@@ -91,7 +91,7 @@
# so we need targets `a', `so', and `dll'.
.PHONY: lib
-lib: libgc$(PROF).lib
+lib: lib$(GC_GRADE).lib
.PHONY: so
so:
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.56
diff -u -d -r1.56 Mmakefile
--- Mmakefile 2000/06/22 08:50:19 1.56
+++ Mmakefile 2000/08/16 15:02:07
@@ -104,15 +104,8 @@
.PHONY: boehm_gc
boehm_gc: scripts
- case $(GRADE) in \
- *.prof*) \
- prof=_prof \
- ;; \
- *) \
- prof= \
- ;; \
- esac; \
- cd boehm_gc && $(SUBDIR_MMAKE) PROF=$$prof
+ gc_grade=`scripts/ml --grade $(GRADE) --print-gc-grade`
+ cd boehm_gc && $(SUBDIR_MMAKE) GC_GRADE=$$gc_grade
.PHONY: runtime
runtime: scripts boehm_gc
@@ -303,15 +296,8 @@
.PHONY: install_boehm_gc
install_boehm_gc: boehm_gc
- case $(GRADE) in \
- *.prof*) \
- prof=_prof \
- ;; \
- *) \
- prof= \
- ;; \
- esac; \
- cd boehm_gc && $(SUBDIR_MMAKE) install PROF=$$prof
+ gc_grade=`scripts/ml --grade $(GRADE) --print-gc-grade`
+ cd boehm_gc && $(SUBDIR_MMAKE) install GC_GRADE=$$gc_grade
.PHONY: install_library
install_library: dep_library library
@@ -358,16 +344,9 @@
#
for grade in x $(LIBGRADES); do \
if [ "$$grade" != "x" ]; then \
- case "$$grade" in \
- *.prof*) \
- prof=_prof \
- ;; \
- *) \
- prof= \
- ;; \
- esac; \
+ gc_grade=`scripts/ml --grade $$grade --print-gc-grade`
( cd boehm_gc && \
- $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade PROF=$$prof \
+ $(SUBDIR_MMAKE) MC=mmc GRADE=$$grade GC_GRADE=$$gc_grade \
install_lib ) && \
( cd runtime && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_lib ) && \
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.78
diff -u -d -r1.78 ml.in
--- scripts/ml.in 2000/06/16 16:37:41 1.78
+++ scripts/ml.in 2000/08/16 14:56:36
@@ -75,6 +75,8 @@
leave_shlib_dirs_relative=false
user_shlib_dirs=""
use_thread_libs=false
+print_grade=false
+print_gc_grade=false
# include the file `init_grade_options.sh-subr'
@INIT_GRADE_OPTIONS@
@@ -100,6 +102,14 @@
executables, unresolved symbols are always errors.
This option is useful when building shared libraries
that are not intended to be self-contained.
+ --print-grade
+ Compute the grade of the Mercury libraries to link with based
+ on the command line options, print it to the standard output,
+ and then exit (don't actually link anything).
+ --print-gc-grade
+ Compute the base name of the garbage collection library to
+ link with based on the command line options, print it to the
+ standard output, and then exit (don't actually link anything).
Dynamic/static linking options:
--mercury-libs {shared, static, none}
@@ -284,6 +294,19 @@
use_thread_libs=false
;;
+ --print-grade)
+ print_grade=true
+ ;;
+ --no-print-grade)
+ print_grade=false
+ ;;
+ --print-gc-grade)
+ print_gc_grade=true
+ ;;
+ --no-print-gc-grade)
+ print_gc_grade=false
+ ;;
+
# include the file `parse_grade_options.sh-subr'
@PARSE_GRADE_OPTIONS@
@@ -438,20 +461,45 @@
false,false) ;;
esac
+# if the --print-grade option is specified,
+# then all we do is print the grade and then exit
+case "$print_grade" in true)
+ echo $GRADE
+ exit 0
+esac
+
+# Compute the gc grade from the grade
case "$GRADE" in
- *.gc.prof*)
- LIBGC="-lgc_prof"
- LIBGC_STATIC=`@CYGPATH@ $LIBDIR/$FULLARCH/libgc_prof. at LIB_SUFFIX@`
- ;;
+ *.par*.gc*.prof*)
+ gc_grade=par_gc_prof ;;
+ *.par*.gc*)
+ gc_grade=par_gc ;;
+ *.gc*.prof*)
+ gc_grade=gc_prof ;;
*.gc*)
- LIBGC="-lgc"
- LIBGC_STATIC=`@CYGPATH@ $LIBDIR/$FULLARCH/libgc. at LIB_SUFFIX@`
- ;;
+ gc_grade=gc ;;
*)
+ gc_grade=nogc ;;
+esac
+
+# if the --print-gc-grade option is specified,
+# then all we do is print the gc grade and then exit
+case "$print_gc_grade" in true)
+ echo $gc_grade
+ exit 0
+esac
+
+case "$gc_grade" in
+ nogc)
LIBGC=
LIBGC_STATIC=
;;
+ *)
+ LIBGC="-l$gc_grade"
+ LIBGC_STATIC=`@CYGPATH@ $LIBDIR/$FULLARCH/lib$gc_grade. at LIB_SUFFIX@`
+ ;;
esac
+
case $readline in
true) ;;
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list