blob: 3e01a58a4890182696b71acc81f8969797cdeb0c [file] [log] [blame]
##===- Makefile.f2c ----------------------------------------*- Makefile -*-===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
# Enable running Fortran programs with LLVM by using f2c to convert to C and
# link with libf2c, but only until we have a Fortran front-end.
#
##===----------------------------------------------------------------------===##
# FIXME: This would be autoconf'd
include $(LEVEL)/Makefile.config
# Make sure the correct targets come first.
ifdef TEST
test::
else
all::
endif
ifneq ($(USE_F2C),1)
all test::
echo "The f2c program was not found"
exit 1
endif
.PRECIOUS: %.c
clean::
rm -f $(Source:%.f=%.c)
%.c: %.f
$(F2C) $< > /dev/null 2>&1
CPPFLAGS = -I$(F2C_INC)
LDFLAGS += -L$(F2C_LIB) -lf2c
# 'main' is defined in the f2c runtime library. The function exported from the
# program is named MAIN__
EXTRA_LINKTIME_OPT_FLAGS += -internalize-public-api-list=MAIN__