Skip to content

Commit d823af7

Browse files
committed
Update Makefiles
1 parent b86491d commit d823af7

File tree

5 files changed

+62
-34
lines changed

5 files changed

+62
-34
lines changed

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
33
LIB = dfftpack
44

55
FC = gfortran
6-
FFLAGS = -O2
6+
FFLAGS = -O2 -fPIC
77

88
export LIB
99
export FC
1010
export FFLAGS
1111

12-
.PHONY: all clean test
12+
.PHONY: build clean test
1313

14-
all:
15-
$(MAKE) -f Makefile --directory=src
16-
$(MAKE) -f Makefile --directory=test
14+
build:
15+
$(MAKE) -f Makefile $@ --directory=src
1716

18-
test:
19-
$(MAKE) -f Makefile --directory=test
17+
test: build
18+
$(MAKE) -f Makefile $@ --directory=test
19+
20+
bench: build
21+
$(MAKE) -f Makefile $@ --directory=example
2022

2123
clean:
22-
$(MAKE) -f Makefile clean --directory=src
23-
$(MAKE) -f Makefile clean --directory=test
24+
$(MAKE) -f Makefile $@ --directory=src
25+
$(MAKE) -f Makefile $@ --directory=test
26+
$(MAKE) -f Makefile $@ --directory=example

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fftpack = { git="https://github.com/fortran-lang/fftpack.git" }
3131
Alternatively, you can build using provided `Makefile`:
3232
```bash
3333
make
34+
make test
3435
```
3536

3637
## Links

example/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SRCF90 = \
2+
bench1.f90
3+
4+
OBJ = $(SRCF90:%.f90=%.o)
5+
6+
build: bench1.x
7+
8+
bench: build
9+
./bench1.x
10+
11+
bench1.x: $(OBJ)
12+
$(FC) $(FFLAGS) $(OBJ) -L../src -l$(LIB) -I../src -o $@
13+
14+
%.o: %.f90
15+
$(FC) $(FFLAGS) -I../src -c $<
16+
17+
clean:
18+
rm -f -r *.o *.x

src/Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SRCF = \
1+
SRCF90 = \
22
zfftb.f90\
33
cfftb1.f90\
44
zfftf.f90\
@@ -47,9 +47,7 @@ SRCF = \
4747
dsinqi.f90\
4848
dsint.f90\
4949
sint1.f90\
50-
dsinti.f90
51-
52-
SRCF90 = \
50+
dsinti.f90\
5351
fftpack.f90\
5452
fftpack_fft.f90\
5553
fftpack_ifft.f90\
@@ -59,16 +57,20 @@ SRCF90 = \
5957
fftpack_ifftshift.f90\
6058
fftpack_qct.f90\
6159
fftpack_iqct.f90\
62-
fftpack_dct.f90\
60+
fftpack_dct.f90
61+
62+
SRCFPP = \
6363
rk.F90
6464

65-
OBJF := $(SRCF:.f90=.o)
66-
OBJF90 := $(SRCF90:.f90=.o)
65+
OBJ = $(SRCF90:.f90=.o)
66+
OBJ += $(SRCFPP:.F90=.o)
67+
68+
build: lib$(LIB).a lib$(LIB).so
6769

68-
lib$(LIB).a: $(OBJF) $(OBJF90)
69-
ar -rcs lib$(LIB).a $(OBJF) $(OBJF90)
70+
lib$(LIB).a: $(OBJ)
71+
ar -rcs lib$(LIB).a $(OBJ)
7072

71-
shared: $(OBJ)
73+
lib$(LIB).so: $(OBJ)
7274
$(FC) -shared -o lib$(LIB).so $(OBJ)
7375

7476
clean:

test/Makefile

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
FETCH = curl -L
22

3-
SRC = \
3+
SRCF90 = \
44
test_fftpack_fft.f90 \
55
test_fftpack_rfft.f90 \
6-
test_fftpack_qct.f90 \
7-
test_fftpack_dct.f90 \
86
test_fftpack_utils.f90 \
9-
test_fftpack.f90 \
7+
test_fftpack.f90
8+
9+
SRCFPP = \
10+
test_fftpack_qct.F90 \
11+
test_fftpack_dct.F90 \
1012
testdrive.F90
11-
12-
OBJ = $(SRC:.f90=.o)
13-
OBJ := $(OBJ:.F90=.o)
1413

15-
all: tstfft \
16-
test_fftpack
14+
OBJ = $(SRCF90:%.f90=%.o)
15+
OBJ += $(SRCFPP:%.F90=%.o)
16+
17+
build: tstfft.x \
18+
test_fftpack.x
19+
20+
test: build
21+
./tstfft.x
22+
./test_fftpack.x
1723

1824
# Orginal test
19-
tstfft: tstfft.f
20-
$(FC) $(FFLAGS) $< -L../src -l$(LIB) -I../src -o $@.x
21-
time ./tstfft.x
25+
tstfft.x: tstfft.f
26+
$(FC) $(FFLAGS) $< -L../src -l$(LIB) -I../src -o $@
2227

2328
# `fftpack` fft routines
24-
test_fftpack: $(OBJ)
25-
$(FC) $(FFLAGS) $(OBJ) -L../src -l$(LIB) -I../src -o $@.x
26-
./test_fftpack.x
29+
test_fftpack.x: $(OBJ)
30+
$(FC) $(FFLAGS) $(OBJ) -L../src -l$(LIB) -I../src -o $@
2731

2832
testdrive.F90:
2933
$(FETCH) https://github.com/fortran-lang/test-drive/raw/v0.4.0/src/testdrive.F90 > $@

0 commit comments

Comments
 (0)