8000 Updating examples to build executables to bin directory · arrayfire/arrayfire-fortran@238b00e · GitHub
[go: up one dir, main page]

Skip to content

Commit 238b00e

Browse files
committed
Updating examples to build executables to bin directory
1 parent 85d235d commit 238b00e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

examples/Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
AF_FORT_PATH?=$(shell (dirname `pwd`))
1+
AF_FORT_EXAMPLE_DIR=$(shell pwd)
2+
AF_FORT_PATH?=$(shell (dirname $(AF_FORT_EXAMPLE_DIR)))
3+
AF_FORT_BIN_DIR?=$(AF_FORT_PATH)/bin
24

35
-include $(AF_FORT_PATH)/common.mk
46

@@ -7,13 +9,14 @@ LDFLAGS += -Wl,--no-as-needed -L$(AF_FORT_LIB_PATH) -l$(AF_FORT) -L$(AF_LIB_PATH
79
LDFLAGS += -Wl,-rpath,$(AF_FORT_LIB_PATH),-rpath,$(abspath $(AF_FORT_LIB_PATH))
810
LDFLAGS += -Wl,-rpath,$(AF_LIB_PATH),-rpath,$(abspath $(AF_LIB_PATH))
911

10-
SRC:=$(wildcard *.f90)
11-
BIN:=$(patsubst %.f90, %, $(SRC))
12+
SRC:=$(wildcard $(AF_FORT_EXAMPLE_DIR)/*.f90)
13+
BIN:=$(patsubst $(AF_FORT_EXAMPLE_DIR)/%.f90, $(AF_FORT_BIN_DIR)/%, $(SRC))
1214

1315
all: $(BIN)
1416

15-
%: %.f90 $(AF_FORT_MOD)
16-
gfortran -L$(AF_PATH)/$(LIB) $(CFLAGS) $(LDFLAGS) $(AF_FORT_MOD) -o $@ $<
17+
$(AF_FORT_BIN_DIR)/%: $(AF_FORT_EXAMPLE_DIR)/%.f90 $(AF_FORT_MOD)
18+
@echo Building $(shell (basename $@))
19+
@gfortran -L$(AF_PATH)/$(LIB) $(CFLAGS) $(LDFLAGS) $(AF_FORT_MOD) -o $@ $<
1720

1821
clean:
1922
rm -f $(BIN)

0 commit comments

Comments
 (0)
0