-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (68 loc) · 2.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ifneq ($(prefix), )
install_dir=$(prefix)
else
install_dir=$(DEFAULT_INSTALL_DIR)
endif
ifneq ($(type), )
btype=$(type)
else
btype=release
endif
SRC_FYPP=$(wildcard ./src/*.fypp)
.PHONY: build doc docs clean logo
all: $(LIBNAME)
$(LIBNAME): build copy_a shared
build:
fpm build --profile=$(btype)
test: build
fpm test --profile=$(btype)
example: build
fpm run --profile=$(btype) --example example_in_f
fpm run --profile=$(btype) --example example_in_c
copy_a:
cp -f $(shell find ./build/gfortran* -type f -name $(LIBNAME).a) $(BUILD_DIR)
shared: shared_$(PLATFORM)
shared_linux:
$(FC) -shared -o $(BUILD_DIR)/$(LIBNAME).so -Wl,--whole-archive $(BUILD_DIR)/$(LIBNAME).a -Wl,--no-whole-archive
shared_darwin:
$(FC) -dynamiclib -install_name @rpath/$(LIBNAME).dylib $(FPM_LDFLAGS) -o $(BUILD_DIR)/$(LIBNAME).dylib -Wl,-all_load $(BUILD_DIR)/$(LIBNAME).a
shared_windows:
$(FC) -shared $(FPM_LDFLAGS) -o $(BUILD_DIR)/$(LIBNAME).dll -Wl,--out-implib=$(BUILD_DIR)/$(LIBNAME).dll.a,--export-all-symbols,--enable-auto-import,--whole-archive $(BUILD_DIR)/$(LIBNAME).a -Wl,--no-whole-archive
install: install_dirs install_$(PLATFORM)
install_dirs:
mkdir -p $(install_dir)/bin
mkdir -p $(install_dir)/include
mkdir -p $(install_dir)/lib
fpm install --prefix=$(install_dir) --profile=$(btype)
cp -f $(INCLUDE_DIR)/$(NAME)*.h $(install_dir)/include
install_linux:
cp -f $(BUILD_DIR)/$(LIBNAME).so $(install_dir)/lib
install_darwin:
cp -f $(BUILD_DIR)/$(LIBNAME).dylib $(install_dir)/lib
install_windows:
cp -f $(BUILD_DIR)/$(LIBNAME).dll.a $(install_dir)/lib
cp -f $(BUILD_DIR)/$(LIBNAME).dll $(install_dir)/lib
cp -f $(BUILD_DIR)/$(LIBNAME).dll $(install_dir)/bin
uninstall:
rm -f $(install_dir)/include/$(NAME)*.h
rm -f $(install_dir)/include/$(NAME)*.mod
rm -f $(install_dir)/lib/$(LIBNAME).a
rm -f $(install_dir)/lib/$(LIBNAME).so
rm -f $(install_dir)/lib/$(LIBNAME).dylib
rm -f $(install_dir)/lib/$(LIBNAME).dll.a
rm -f $(install_dir)/lib/$(LIBNAME).dll
rm -f $(install_dir)/bin/$(LIBNAME).dll
clean:
fpm clean --all
make -C py clean
rm -rf API-doc/*
doc:
ford API-doc-FORD-file.md
docs:
rm -rf docs/*
cp -rf API-doc/* ./docs/
logo:
make -C media
py: $(LIBNAME)
make install prefix=py/$(PY_SRC)
make -C py