aboutsummaryrefslogtreecommitdiff
path: root/Makefile.f2c
blob: 3e01a58a4890182696b71acc81f8969797cdeb0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
##===- 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__