Debian提升Fortran开发效率的实用方案
一 环境搭建与工具链
二 构建与依赖管理
FC = gfortran
FFLAGS = -O2 -Wall -Wextra
SRCS = main.f90 utils.f90
OBJS = $(SRCS:.f90=.o)
TARGET = app
all: $(TARGET)
$(TARGET): $(OBJS)
$(FC) $(FFLAGS) -o $@ $^
%.o: %.f90
$(FC) $(FFLAGS) -c $<
clean:
rm -f $(OBJS) $(TARGET)
三 性能优化要点
四 调试与可移植性
五 工作流自动化与CI
name: Fortran CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install gfortran
run: sudo apt update && sudo apt install -y gfortran
- name: Build and run
run: gfortran hello.f90 -o hello && ./hello
每次推送或 PR 自动构建与测试,及早发现问题。