mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
add Fortran demo
This commit is contained in:
parent
8ad708cc9d
commit
3aa4abcba9
3 changed files with 48 additions and 3 deletions
|
@ -14,6 +14,7 @@ QEMU = qemu-kvm -cpu host
|
|||
CROSSCOMPREFIX = x86_64-hermit-
|
||||
STACKPROT = -fno-stack-protector
|
||||
|
||||
FC_FOR_TARGET = $(CROSSCOMPREFIX)gfortran
|
||||
CC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
CXX_FOR_TARGET = $(CROSSCOMPREFIX)g++
|
||||
GCC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
|
@ -58,6 +59,7 @@ KEEP_DEBUG = --only-keep-debug
|
|||
OUTPUT_FORMAT = -O elf32-i386
|
||||
|
||||
CFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -ftls-model=initial-exec -O3 #-mavx2 -mfma -mtune=intel #$(STACKPROT)
|
||||
FFLAGS_FOR_NEWLIB = -O3
|
||||
CXXFLAGS_FOR_NEWLIB =
|
||||
LDFLAGS_FOR_NEWLIB =
|
||||
NASMFLAGS_FOR_NEWLIB = -felf64
|
||||
|
@ -80,9 +82,11 @@ toolchain:
|
|||
$Q$(MAKE) ARCH=$(ARCH) \
|
||||
LDFLAGS_FOR_TARGET="$(LDFLAGS_FOR_NEWLIB)" \
|
||||
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_NEWLIB)" \
|
||||
FFLAGS_FOR_TARGET="$(FFLAGS_FOR_NEWLIB)" \
|
||||
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_NEWLIB)" \
|
||||
NASMFLAGS="$(NASMFLAGS_FOR_NEWLIB)" \
|
||||
CC_FOR_TARGET=$(CC_FOR_TARGET) \
|
||||
FC_FOR_TARGET=$(FC_FOR_TARGET) \
|
||||
CXX_FOR_TARGET=$(CXX_FOR_TARGET) \
|
||||
GCC_FOR_TARGET=$(GCC_FOR_TARGET) \
|
||||
AR_FOR_TARGET=$(AR_FOR_TARGET) \
|
||||
|
|
|
@ -37,9 +37,13 @@ endif
|
|||
@echo [CXX] $@
|
||||
$Q$(CXX_FOR_TARGET) -c $(CXXFLAGS_FOR_TARGET) $(CFLAGS_FOR_TARGET) -o $@ $<
|
||||
|
||||
%.o: %.f90
|
||||
@echo [F90] $@
|
||||
$Q$(FC_FOR_TARGET) -c $(FFLAGS_FOR_TARGET) -o $@ $<
|
||||
|
||||
default: all
|
||||
|
||||
all: hello hello++ jacobi stream thr_hello
|
||||
all: hello hello++ hellof jacobi stream thr_hello
|
||||
|
||||
stream.o: stream.c
|
||||
@echo [CC] $@
|
||||
|
@ -66,6 +70,13 @@ hello: hello.o
|
|||
$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
$Qchmod a-x $@.sym
|
||||
|
||||
hellof: hellof.o
|
||||
@echo [LD] $@
|
||||
$Q$(FC_FOR_TARGET) $(LDFLAGS_FOR_TARGET) $(FFLAGS_FOR_TARGET) -o $@ $<
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
$Qchmod a-x $@.sym
|
||||
|
||||
jacobi: jacobi.o
|
||||
@echo [LD] $@
|
||||
$Q$(CC_FOR_TARGET) $(LDFLAGS_FOR_TARGET) $(CFLAGS_FOR_TARGET) -o $@ $< -lm
|
||||
|
@ -86,11 +97,11 @@ thr_hello: thr_hello.o
|
|||
|
||||
clean:
|
||||
@echo Cleaning examples
|
||||
$Q$(RM) hello hello++ jacobi stream thr_hello *.sym *.o *~
|
||||
$Q$(RM) hello hello++ hellof jacobi stream thr_hello *.sym *.o *~
|
||||
|
||||
veryclean:
|
||||
@echo Propper cleaning examples
|
||||
$Q$(RM) hello hello++ jacobi stream thr_hello *.sym *.o *~
|
||||
$Q$(RM) hello hello++ hellof jacobi stream thr_hello *.sym *.o *~
|
||||
|
||||
depend:
|
||||
$Q$(CC_FOR_TARGET) -MM $(CFLAGS_FOR_TARGET) *.c > Makefile.dep
|
||||
|
|
30
hermit/usr/examples/hellof.f90
Normal file
30
hermit/usr/examples/hellof.f90
Normal file
|
@ -0,0 +1,30 @@
|
|||
!
|
||||
! Copyright (c) 2015, Stefan Lankes, RWTH Aachen University
|
||||
! All rights reserved.
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions are met:
|
||||
! * Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! * Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! * Neither the name of the University nor the names of its contributors
|
||||
! may be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
! ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
! WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
! DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
! DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
! ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
|
||||
program hellof
|
||||
print *, "HelloWorld from gfortran!"
|
||||
end program hellof
|
Loading…
Add table
Reference in a new issue