Skip to content

Commit

Permalink
Merge pull request #2 from fortran-fans/add_fpm_support
Browse files Browse the repository at this point in the history
Add fpm support for fftapck with double precision
  • Loading branch information
certik authored Jul 28, 2021
2 parents 030cbf4 + b3cbec3 commit a8f7ae8
Show file tree
Hide file tree
Showing 61 changed files with 236 additions and 89 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build*

# Compiled objects
*.o
*.a
*.so
*.x
105 changes: 16 additions & 89 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,96 +1,23 @@
# Several changes made by HCP so this would build without trouble
# on a Linux/g77 system.
# (1) changed step to build library to use ar instead of update
# (update must mean something different on someone elses Unix.)
# (2) Added make clean step
# (3) In test step, changed a.out to ./a.out for cautious folk who don't
# have "." in their PATH.
# (4) Change FFLAGS from -O to -O2 -funroll-loops
# (5) Specify FC=gcc in case /usr/bin/f77 is not a link to g77
# (as it won't be if you have f77reorder installed)
# (6) Added targets shared and installshared to make and install a shared
# version of the library. You need /usr/local/lib in /etc/ld.so.conf
# for this to work
# (7) Modified names for dble prec version
LIB=dfftpack
# Fortran fftpack Makefile

# Use these lines for Linux/g77
FC=g77
FFLAGS=-O2 -funroll-loops -fexpensive-optimizations
LIB = dfftpack

# Use these lines for Solaris
#FC=f77
#FFLAGS=-fast -O5
FC = gfortran
FFLAGS = -O2

OBJ=\
zfftb.o\
cfftb1.o\
zfftf.o\
cfftf1.o\
zffti.o\
cffti1.o\
dcosqb.o\
cosqb1.o\
dcosqf.o\
cosqf1.o\
dcosqi.o\
dcost.o\
dcosti.o\
ezfft1.o\
dzfftb.o\
dzfftf.o\
dzffti.o\
passb.o\
passb2.o\
passb3.o\
passb4.o\
passb5.o\
passf.o\
passf2.o\
passf3.o\
passf4.o\
passf5.o\
radb2.o\
radb3.o\
radb4.o\
radb5.o\
radbg.o\
radf2.o\
radf3.o\
radf4.o\
radf5.o\
radfg.o\
dfftb.o\
rfftb1.o\
dfftf.o\
rfftf1.o\
dffti.o\
rffti1.o\
dsinqb.o\
dsinqf.o\
dsinqi.o\
dsint.o\
sint1.o\
dsinti.o
export LIB
export FC
export FFLAGS

lib$(LIB).a: $(OBJ)
ar -rcs lib$(LIB).a $(OBJ)
.PHONY: all clean test

shared:$(OBJ)
$(FC) -shared -o lib$(LIB).so $(OBJ)
all:
$(MAKE) -f Makefile --directory=src
$(MAKE) -f Makefile --directory=test

install: lib$(LIB).a
mv lib$(LIB).a /usr/local/lib
rm *.o
test:
$(MAKE) -f Makefile --directory=test

installshared:lib$(LIB).so
mv lib$(LIB).so /usr/local/lib
rm *.o
ldconfig

test: test.o
$(FC) test.o -L./ -l$(LIB)
time ./a.out

clean:
rm -f -r *.o *.a *.so
clean:
$(MAKE) -f Makefile clean --directory=src
$(MAKE) -f Makefile clean --directory=test
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# FFTPACK
A package of fortran subprograms for the fast fourier transform of periodic and other symmetric sequences.

## Getting started
### Get the code
```bash
git clone https://github.com/certik/fftpack.git
cd fftpack
```

### Build with [fortran-lang/fpm](https://github.com/fortran-lang/fpm)
Fortran Package Manager (fpm) is a great package manager and build system for Fortran.
You can build using provided `fpm.toml`:
```bash
fpm build --flag "-O2"
fpm test --flag "-O2" tstfft
```
To use `fftpack` within your `fpm` project, add the following to your `fpm.toml` file:
```toml
[dependencies]
fftpack = { git="https://github.com/certik/fftpack.git" }
```

## Build with Make
Alternatively, you can build using provided `Makefile`:
```bash
make
```

## Links
[netlib/dfftpack1.0(fftpack4.0)](http://www.netlib.org/fftpack/)
96 changes: 96 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Several changes made by HCP so this would build without trouble
# on a Linux/g77 system.
# (1) changed step to build library to use ar instead of update
# (update must mean something different on someone elses Unix.)
# (2) Added make clean step
# (3) In test step, changed a.out to ./a.out for cautious folk who don't
# have "." in their PATH.
# (4) Change FFLAGS from -O to -O2 -funroll-loops
# (5) Specify FC=gcc in case /usr/bin/f77 is not a link to g77
# (as it won't be if you have f77reorder installed)
# (6) Added targets shared and installshared to make and install a shared
# version of the library. You need /usr/local/lib in /etc/ld.so.conf
# for this to work
# (7) Modified names for dble prec version
LIB=dfftpack

# Use these lines for Linux/g77
FC=g77
FFLAGS=-O2 -funroll-loops -fexpensive-optimizations

# Use these lines for Solaris
#FC=f77
#FFLAGS=-fast -O5

OBJ=\
zfftb.o\
cfftb1.o\
zfftf.o\
cfftf1.o\
zffti.o\
cffti1.o\
dcosqb.o\
cosqb1.o\
dcosqf.o\
cosqf1.o\
dcosqi.o\
dcost.o\
dcosti.o\
ezfft1.o\
dzfftb.o\
dzfftf.o\
dzffti.o\
passb.o\
passb2.o\
passb3.o\
passb4.o\
passb5.o\
passf.o\
passf2.o\
passf3.o\
passf4.o\
passf5.o\
radb2.o\
radb3.o\
radb4.o\
radb5.o\
radbg.o\
radf2.o\
radf3.o\
radf4.o\
radf5.o\
radfg.o\
dfftb.o\
rfftb1.o\
dfftf.o\
rfftf1.o\
dffti.o\
rffti1.o\
dsinqb.o\
dsinqf.o\
dsinqi.o\
dsint.o\
sint1.o\
dsinti.o

lib$(LIB).a: $(OBJ)
ar -rcs lib$(LIB).a $(OBJ)

shared:$(OBJ)
$(FC) -shared -o lib$(LIB).so $(OBJ)

install: lib$(LIB).a
mv lib$(LIB).a /usr/local/lib
rm *.o

installshared:lib$(LIB).so
mv lib$(LIB).so /usr/local/lib
rm *.o
ldconfig

test: test.o
$(FC) test.o -L./ -l$(LIB)
time ./a.out

clean:
rm -f -r *.o *.a *.so
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

name = "fftpack"
description = "A package of fortran subprograms for the fast fourier transform of periodic and other symmetric sequences"
homepage = "http://www.netlib.org/fftpack/"
version = "4.0.0"
license = "Public Domain"
author = "Paul N. Swarztrauber"
maintainer = "@fortran-lang"
copyright = "Copyright 1985 National Center for Atmospheric Research, Boulder, CO"
categories = ["Fast Fourier Transform"]
keywords = ["netlib", "fftpack", "fft"]

[build]
auto-executables = false
auto-tests = false
auto-examples = false

[[test]]
name = "tstfft"
source-dir = "test"
main = "tstfft.f"
59 changes: 59 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
OBJ = \
zfftb.o\
cfftb1.o\
zfftf.o\
cfftf1.o\
zffti.o\
cffti1.o\
dcosqb.o\
cosqb1.o\
dcosqf.o\
cosqf1.o\
dcosqi.o\
dcost.o\
dcosti.o\
ezfft1.o\
dzfftb.o\
dzfftf.o\
dzffti.o\
passb.o\
passb2.o\
passb3.o\
passb4.o\
passb5.o\
passf.o\
passf2.o\
passf3.o\
passf4.o\
passf5.o\
radb2.o\
radb3.o\
radb4.o\
radb5.o\
radbg.o\
radf2.o\
radf3.o\
radf4.o\
radf5.o\
radfg.o\
dfftb.o\
rfftb1.o\
dfftf.o\
rfftf1.o\
dffti.o\
rffti1.o\
dsinqb.o\
dsinqf.o\
dsinqi.o\
dsint.o\
sint1.o\
dsinti.o

lib$(LIB).a: $(OBJ)
ar -rcs lib$(LIB).a $(OBJ)

shared: $(OBJ)
$(FC) -shared -o lib$(LIB).so $(OBJ)

clean:
rm -f -r *.o *.a *.so
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tstfft: tstfft.o
$(FC) tstfft.o -L../src -l$(LIB) -o a.x
time ./a.x

clean:
rm -f -r *.o *.x
File renamed without changes.

0 comments on commit a8f7ae8

Please sign in to comment.