Files
mercury/util/Mmakefile
Peter Wang 544f3bf095 Use musl getopt implementation.
LICENSE:
    Mention files derived from musl library.

runtime/process_getopt:
    Process files from ../getopt/*.[ch] to produce
    mercury_getopt.h, mercury_getopt.c, mercury_getopt_long.c.

runtime/mercury_getopt.h:
runtime/mercury_getopt.c:
runtime/mercury_getopt_long.c:
    Add files generated by process_getopt.

runtime/Mmakefile:
    Update list of source files.

util/Mmakefile:
    Use musl getopt if the system C library does not have getopt().

tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
tests/debugger/browser_test.exp3:
tests/hard_coded/runtime_opt.exp:
    Update expected error messages to match new getopt() output.

changed exp output
2019-06-10 13:30:49 +10:00

103 lines
3.2 KiB
Plaintext

#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab
#-----------------------------------------------------------------------------#
# Copyright (C) 1995-2002, 2005, 2006-2007, 2010, 2012 The University of Melbourne.
# Copyright (C) 2013, 2019 The Mercury team.
# 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 utilities directory
MAIN_TARGET=all
#-----------------------------------------------------------------------------#
MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common
#-----------------------------------------------------------------------------#
# We need -I$(RUNTIME_DIR) for "mercury_std.h", etc.
CFLAGS = -I$(RUNTIME_DIR)
PROGS=mkinit mkinit_erl mdemangle mfiltercc info_to_mdb
PROGFILENAMES=$(PROGS:%=%$(EXT_FOR_EXE))
SRC=$(PROGS:%=%.c)
# Link in local copy of getopt() only if required.
ifeq ("$(HAVE_GETOPT)","no")
GETOPT_SRC=../getopt/getopt.c
else
GETOPT_SRC=
endif
# mkinit.c needs `struct stat'
MGNUCFLAGS-mkinit = --no-ansi
MGNUCFLAGS-mkinit_erl = --no-ansi
# For the C distribution mfiltercc may not be available until after we build
# it here.
MGNUCFLAGS-mfiltercc = --no-filter-cc
#-----------------------------------------------------------------------------#
all: $(PROGFILENAMES) $(TAGS_FILE_EXISTS)
ifeq ($(USING_MICROSOFT_CL_COMPILER),yes)
.c$(EXT_FOR_EXE):
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -Fe$@ $< $(GETOPT_SRC)
mkinit$(EXT_FOR_EXE): mkinit.c mkinit_common.c mkinit_common.h
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -Fe$@ \
mkinit.c mkinit_common.c $(GETOPT_SRC)
mkinit_erl$(EXT_FOR_EXE): mkinit_erl.c mkinit_common.c mkinit_common.h
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -Fe$@ \
mkinit_erl.c mkinit_common.c $(GETOPT_SRC)
else
.c$(EXT_FOR_EXE):
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ $< $(GETOPT_SRC)
mkinit$(EXT_FOR_EXE): mkinit.c mkinit_common.c mkinit_common.h
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ \
mkinit.c mkinit_common.c $(GETOPT_SRC)
mkinit_erl$(EXT_FOR_EXE): mkinit_erl.c mkinit_common.c mkinit_common.h
$(MGNUC) --no-mercury-stdlib-dir \
$(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ \
mkinit_erl.c mkinit_common.c $(GETOPT_SRC)
endif
tags:
ctags $(SRC)
.PHONY: tags_file_exists
tags_file_exists:
@if test ! -f tags; then echo making tags; \
ctags $(SRC) ; fi
#-----------------------------------------------------------------------------#
.PHONY: install
install: $(PROGFILENAMES)
[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
cp `vpath_find $(PROGFILENAMES)` $(INSTALL_BINDIR)
.PHONY: uninstall
uninstall:
-cd $(INSTALL_BINDIR) && rm $(PROGS)
#-----------------------------------------------------------------------------#
realclean_local:
-rm -f $(PROGFILENAMES)
#-----------------------------------------------------------------------------#