-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·147 lines (116 loc) · 4.11 KB
/
Makefile
File metadata and controls
executable file
·147 lines (116 loc) · 4.11 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
##########################################################################
#
# This file is part of FORCE - Framework for Operational Radiometric
# Correction for Environmental monitoring.
#
# Copyright (C) 2013-2024 David Frantz
#
# FORCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FORCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FORCE. If not, see <http://www.gnu.org/licenses/>.
#
##########################################################################
##########################################################################
# Modify the following lines to match your needs
##########################################################################
# Installation directory
INSTALLDIR=/usr/local/bin
# Libraries
GDAL_INCLUDES = $(shell gdal-config --cflags)
GDAL_LIBS = $(shell gdal-config --libs)
GDAL_FLAGS = -Wl,-rpath=/usr/lib
GSL_INCLUDES = $(shell gsl-config --cflags)
GSL_LIBS = $(shell gsl-config --libs)
GSL_FLAGS = -Wl,-rpath=/usr/lib/x86_64-linux-gnu -DHAVE_INLINE=1 -DGSL_RANGE_CHECK=0
CURL_INCLUDES = -I/usr/include/curl -I/usr/include/x86_64-linux-gnu/curl
CURL_LIBS = -L/usr/lib/x86_64-linux-gnu -lcurl
CURL_FLAGS = -Wl,-rpath=/usr/lib/x86_64-linux-gnu
OPENCV_INCLUDES = $(shell pkg-config --cflags opencv4)
OPENCV_LIBS = $(shell pkg-config --libs opencv4)
OPENCV_FLAGS = -Wl,-rpath=/usr/local/lib
PYTHON_INCLUDES = $(shell python3-config --includes)
PYTHON_LIBS = $(shell (python3-config --ldflags --libs --embed || python3-config --ldflags --libs) | tr -d '\n')
NUMPY_INCLUDES = $(shell python3 -c "import numpy; print(numpy.get_include())")
PYTHON_INCLUDES += -I$(NUMPY_INCLUDES)
RSTATS_INCLUDES = $(shell R CMD config --cppflags)
RSTATS_LIBS = $(shell R CMD config --ldflags | sed 's/ /\n/g' | grep '\-L') -lR
##########################################################################
# NO! changes below this line (unless you know what to do, then go ahead)
##########################################################################
### Compiler
# Compilation Flags
CFLAGS=-O3 -Wall -fopenmp
#CFLAGS=-g -Wall -fopenmp
GCC=gcc $(CFLAGS)
G11=g++ -std=c++11 $(CFLAGS)
##########################################################################
# Directories
SRCDIR = src
OBJDIR = obj
BINDIR = bin
BUILDDIR = build
BASHDIR = bash
RSTATSDIR = rstats
PYTHONDIR = python
MISCDIR = misc
# Targets
all: check-tools prepare exe bash rstats python external misc
with_tests: all tests
.PHONY: prepare check-tools bash rstats python external misc \
install clean all with_tests exe tests auch higher lower cross
# Compile targets
include $(BUILDDIR)/cross-level.mk
include $(BUILDDIR)/lower-level.mk
include $(BUILDDIR)/higher-level.mk
include $(BUILDDIR)/aux-level.mk
include $(BUILDDIR)/executables.mk
include $(BUILDDIR)/tests.mk
# Prepare build directories
prepare: check-tools
mkdir -p \
$(OBJDIR) \
$(BINDIR) \
$(BINDIR)/force-misc
# Check installed tools
check-tools:
./check-required.sh
# Bash scripts
bash: prepare
@for file in $(BASHDIR)/*.sh; do \
cp $$file $(BINDIR)/$$(basename $$file .sh); \
done
# R scripts
rstats: prepare
@for file in $(RSTATSDIR)/*.r; do \
cp $$file $(BINDIR)/$$(basename $$file .r); \
done
# Python scripts
python: prepare
@for file in $(PYTHONDIR)/*.py; do \
cp $$file $(BINDIR)/$$(basename $$file .py); \
done
# re-branded tools [with permission]
external: prepare
cp $(shell which landsatlinks) $(BINDIR)/force-level1-landsat
# misc files
misc: prepare
@for item in $(MISCDIR)/*; do \
cp -r $$item $(BINDIR)/force-misc/; \
done
# install the software
install: all
find $(BINDIR) -type f -exec chmod 0755 {} +
find $(BINDIR) -type d -exec chmod 0755 {} +
cp -a $(BINDIR)/. $(INSTALLDIR)
# clean up
clean:
rm -rf $(OBJDIR) $(BINDIR)