Files
mercury/bytecode/Mmakefile
Fergus Henderson 4793bb003e 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().
1997-05-07 12:12:29 +00:00

111 lines
3.1 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1997 University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmake - Mmake file for the Mercury bytecode utilities
MAIN_TARGET=all
MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common
#-----------------------------------------------------------------------------#
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)
MAKEDEPEND = makedepend
# We need VPATH so we can find getopt.h (!)
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 mbi_main.c mdis.c mem.c \
static_data.c template.c util.c
LIBS = -lmer ` \
case "$(GRADE)" in \
*.gc.prof) echo "-lgc_prof" ;; \
*.gc) echo "-lgc" ;; \
esac \
`
#-----------------------------------------------------------------------------#
.PHONY: all
all: mdis mbi libmbi
MDIS_OBJS = bytecode.o disasm.o mdis.o mem.o util.o
mdis: $(MDIS_OBJS)
$(MGNUC) $(CFLAGS) -static -o mdis $(MDIS_OBJS) $(LIBPATH) $(LIBS)
MBI_OBJS = mbi_main.o $(LIBMBI_OBJS)
mbi: $(MBI_OBJS)
$(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)
#-----------------------------------------------------------------------------#
tags: $(ORIG_CS)
ctags $(ORIG_CS)
.PHONY: check_headers
check_headers:
for file in $(HDRS); do \
echo "$$file"; \
echo "#include \"$$file\"" > tmp.c; \
$(MGNUC) $(MGNUCFLAGS) -c tmp.c || exit 1; \
done
rm -f tmp.c
# Create dependencies.
depend: $(ORIG_CS) $(HDR)
if test ! -f depend.mk ; then touch depend.mk ; else true ; fi
$(MAKEDEPEND) $(INCPATH) -f depend.mk $^
#-----------------------------------------------------------------------------#
# installation rules
install:
echo "Module \"bytecode\" does not yet install anything."
uninstall:
echo "Nothing to uninstall for module \"bytecode\""
#-----------------------------------------------------------------------------#
clean:
rm -f *.o *.pic_o
realclean: clean
-$(RM) mbi mdis depend.mk* libmbi.a libmbi.so
#-----------------------------------------------------------------------------#
-include depend.mk
#-----------------------------------------------------------------------------#