mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-15 22:03:26 +00:00
Add new targets libmbi.{a,so}.
Estimated hours taken: 1
bytecode/Mmakefile:
Add new targets libmbi.{a,so}.
In profiling grades, link with -lgc_prof rather than -lgc.
bytecode/mbi.c:
Rename the main() function as BC_mbi_main().
bytecode/mbi_main.c:
New file, whose main() function just calls BC_mbi_main().
This commit is contained in:
2
bytecode/.cvsignore
Normal file
2
bytecode/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
mbi
|
||||
mdis
|
||||
@@ -13,9 +13,9 @@ include $(MERCURY_DIR)/Mmake.common
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
INCPATH = -I$(MERCURY_DIR)/runtime -I$(MERCURY_DIR)/boehm_gc -I.
|
||||
LIBPATH = -L$(MERCURY_DIR)/runtime -L$(MERCURY_DIR)/boehm_gc
|
||||
CFLAGS = -g $(EXTRA_CFLAGS) -D_POSIX_SOURCE $(INCPATH) -static
|
||||
INCPATH = -I$(RUNTIME_DIR) -I$(BOEHM_GC_DIR) -I.
|
||||
LIBPATH = -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
|
||||
CFLAGS = -g $(EXTRA_CFLAGS) -D_POSIX_SOURCE $(INCPATH)
|
||||
MGNUC = MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
|
||||
MGNUCFLAGS = $(CFLAGS)
|
||||
|
||||
@@ -29,32 +29,41 @@ VPATH = $(MERCURY_DIR)/runtime
|
||||
HDRS = bytecode.h disasm.h getopt.h mbi.h mem.h machine.h \
|
||||
mdis.h static_data.h template.h util.h
|
||||
|
||||
ORIG_CS = bytecode.c disasm.c machine.c mbi.c mdis.c mem.c \
|
||||
ORIG_CS = bytecode.c disasm.c machine.c mbi.c mbi_main.c mdis.c mem.c \
|
||||
static_data.c template.c util.c
|
||||
OBJS = $(ORIG_CS:.c=.o)
|
||||
PIC_OBJS = $(OBJS:.o=.pic_o)
|
||||
|
||||
LIBS = -lmer -lgc
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
# XXX if we're using makedepend, this line shouldn't be needed
|
||||
|
||||
$(OBJS) $(PIC_OBJS): $(HDRS)
|
||||
|
||||
LIBS = -lmer ` \
|
||||
case "$(GRADE)" in \
|
||||
*.gc.prof) echo "-lgc_prof" ;; \
|
||||
*.gc) echo "-lgc" ;; \
|
||||
esac \
|
||||
`
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: mdis mbi
|
||||
all: mdis mbi libmbi
|
||||
|
||||
MDIS_OBJS = bytecode.o disasm.o mdis.o mem.o util.o
|
||||
mdis: $(MDIS_OBJS)
|
||||
$(MGNUC) $(CFLAGS) -o mdis $(MDIS_OBJS) $(LIBPATH) $(LIBS)
|
||||
$(MGNUC) $(CFLAGS) -static -o mdis $(MDIS_OBJS) $(LIBPATH) $(LIBS)
|
||||
|
||||
MBI_OBJS = bytecode.o mbi.o mem.o util.o
|
||||
MBI_OBJS = mbi_main.o $(LIBMBI_OBJS)
|
||||
mbi: $(MBI_OBJS)
|
||||
$(MGNUC) $(CFLAGS) -o mbi $(MBI_OBJS) $(LIBPATH) $(LIBS)
|
||||
$(MGNUC) $(CFLAGS) -static -o mbi $(MBI_OBJS) $(LIBPATH) $(LIBS)
|
||||
|
||||
libmbi: libmbi.a libmbi.$(EXT_FOR_SHARED_LIB)
|
||||
|
||||
LIBMBI_OBJS = bytecode.o mbi.o mem.o util.o
|
||||
LIBMBI_PIC_OBJS = $(LIBMBI_OBJS:.o=.$(EXT_FOR_PIC_OBJECTS))
|
||||
|
||||
libmbi.a: $(LIBMBI_OBJS)
|
||||
rm -f libmbi.a
|
||||
ar cr libmbi.a $(LIBMBI_OBJS)
|
||||
|
||||
libmbi.so: $(LIBMBI_OBJS)
|
||||
$(LINK_SHARED_OBJ) -o libmbi.so $(LIBMBI_PIC_OBJS) \
|
||||
$(LIBPATH) $(LIBS) $(SHARED_LIBS)
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
@@ -92,7 +101,7 @@ clean:
|
||||
rm -f *.o *.pic_o
|
||||
|
||||
realclean: clean
|
||||
-$(RM) mbi mdis depend.mk*
|
||||
-$(RM) mbi mdis depend.mk* libmbi.a libmbi.so
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
This directory holds the source code for the Mercury bytecode
|
||||
utilities. `mdis' is the Mercury bytecode disassembler.
|
||||
`mbi' is the Mercury bytecode interpreter.
|
||||
(XXX should it be a stand-alone program, or should it just be a library?)
|
||||
`libmbi' is the same thing, minus main().
|
||||
|
||||
All exported symbols defined in modules in this directory should be prefixed
|
||||
with `MB_', for "Mercury Bytecode", to avoid clashes with names defined in
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
** This file may only be copied under the terms of the GNU Library General
|
||||
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
||||
**
|
||||
** $Id: mbi.c,v 1.7 1997-04-26 05:56:56 fjh Exp $
|
||||
** $Id: mbi.c,v 1.8 1997-05-07 12:12:27 fjh Exp $
|
||||
*/
|
||||
|
||||
/* Imports */
|
||||
@@ -29,7 +29,7 @@
|
||||
/* Local declarations */
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Id: mbi.c,v 1.7 1997-04-26 05:56:56 fjh Exp $";
|
||||
rcs_id[] = "$Id: mbi.c,v 1.8 1997-05-07 12:12:27 fjh Exp $";
|
||||
|
||||
static void
|
||||
usage(void);
|
||||
@@ -39,10 +39,8 @@ program_name = NULL;
|
||||
|
||||
/* Implementation */
|
||||
|
||||
#if ! defined(UNIT_TESTING)
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
BC_mbi_main(int argc, char* argv[])
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -111,8 +109,6 @@ main(int argc, char* argv[])
|
||||
exit(EXIT_SUCCESS);
|
||||
} /* end main() */
|
||||
|
||||
#endif /* ! UNIT_TESTING */
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
@@ -3,10 +3,15 @@
|
||||
** This file may only be copied under the terms of the GNU Library General
|
||||
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
||||
**
|
||||
** $Id: mbi.h,v 1.5 1997-04-26 05:56:58 fjh Exp $
|
||||
** $Id: mbi.h,v 1.6 1997-05-07 12:12:28 fjh Exp $
|
||||
*/
|
||||
|
||||
#ifndef MB_MBI_H
|
||||
#define MB_MBI_H
|
||||
|
||||
/*
|
||||
** BC_mbi_main() is the entry point for the Mercury bytecode interpreter.
|
||||
*/
|
||||
int BC_mbi_main(int argc, char **argv);
|
||||
|
||||
#endif /* ! MB_MBI_H */
|
||||
|
||||
24
bytecode/mbi_main.c
Normal file
24
bytecode/mbi_main.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
** Copyright (C) 1997 University of Melbourne.
|
||||
** This file may only be copied under the terms of the GNU Library General
|
||||
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
||||
**
|
||||
** $Id: mbi_main.c,v 1.1 1997-05-07 12:12:29 fjh Exp $
|
||||
*/
|
||||
|
||||
/* Imports */
|
||||
|
||||
#include "mbi.h"
|
||||
|
||||
/* Local declarations */
|
||||
|
||||
static char
|
||||
rcs_id[] = "$Id: mbi_main.c,v 1.1 1997-05-07 12:12:29 fjh Exp $";
|
||||
|
||||
/* Implementation */
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
return BC_mbi_main(argc, argv);
|
||||
}
|
||||
Reference in New Issue
Block a user