Skip to content

Commit de8bc86

Browse files
committed
scripts
1 parent e5752f2 commit de8bc86

File tree

2 files changed

+54
-48
lines changed

2 files changed

+54
-48
lines changed

Makefile

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
##########################################################################
2626

2727
# Installation directory
28-
BINDIR=/usr/local/bin
28+
INSTALLDIR=/usr/local/bin
2929

3030
# Libraries
3131
GDAL_INCLUDES = -I/usr/include/gdal
@@ -69,11 +69,16 @@ CFLAGS=-O3 -Wall -fopenmp
6969

7070
##########################################################################
7171

72-
# Directories
72+
# Compile directories
7373
SRCDIR = src
7474
OBJDIR = obj
7575
BINDIR = bin
7676

77+
# Script directories
78+
BASHDIR = bash
79+
RSTATSDIR = rstats
80+
PYTHONDIR = python
81+
7782
# Create necessary directories
7883
$(shell mkdir -p $(OBJDIR) $(BINDIR) $(BINDIR)/force-test $(BINDIR)/force-misc)
7984

@@ -109,16 +114,15 @@ TEST_EXE = $(patsubst $(SRCDIR)/tests/%.c, $(BINDIR)/force-test/%, $(TEST_SRC))
109114
DEPENDENCIES = $(CROSS_OBJ:.o=.d) $(LOWER_OBJ:.o=.d) $(HIGHER_OBJ:.o=.d) $(AUX_OBJ:.o=.d)
110115

111116
# Targets
112-
all: exe tests
113-
exe: aux_exe higher_exe lower_exe
114-
aux_exe: $(MAIN_AUX_EXE)
115-
higher_exe: $(MAIN_HIGHER_EXE)
116-
lower_exe: $(MAIN_LOWER_EXE)
117+
all: exe tests scripts
118+
exe: aux higher lower
119+
aux: $(MAIN_AUX_EXE)
120+
higher: $(MAIN_HIGHER_EXE)
121+
lower: $(MAIN_LOWER_EXE)
117122
tests: $(TEST_EXE)
123+
scripts: bash rstats python external
118124
dev: $(BINDIR)/force-stratified-sample # specific target for development
119-
#tests: test_utils-cl test_alloc-cl
120-
#exe: force-parameter force-qai-inflate force-tile-finder force-tabulate-grid force-l2ps force-higher-level force-train force-lut-modis force-mdcp force-stack force-import-modis force-cube-init force-hist force-stratified-sample
121-
#all: temp cross lower higher aux exe unit-tests
125+
.PHONY: bash rstats python external scripts install
122126
#.PHONY: temp all install install_ bash python rstats misc external clean build check
123127

124128
# Include dependencies
@@ -231,25 +235,59 @@ $(BINDIR)/%: $(SRCDIR)/main/higher-level/%.c $(CROSS_OBJ) $(HIGHER_OBJ)
231235
@echo "Compiling $<..."
232236
$(CXX) $(CFLAGS) $(INCLUDES) $(FLAGS) -o $@ $^ $(LIBS)
233237

238+
234239
# Test executables
235240

236241
$(BINDIR)/force-test/%: $(SRCDIR)/tests/%.c $(SRCDIR)/tests/unity/unity.c $(CROSS_OBJ)
237242
@echo "Compiling $<..."
238243
$(CXX) $(CFLAGS) $(INCLUDES) $(FLAGS) -o $@ $^ $(LIBS)
239244

240245

246+
# Bash scripts
247+
248+
bash:
249+
@for file in $(BASHDIR)/*.sh; do \
250+
cp $$file $(BINDIR)/$$(basename $$file .sh); \
251+
done
252+
253+
254+
# R scripts
255+
256+
rstats:
257+
@for file in $(RSTATSDIR)/*.r; do \
258+
cp $$file $(BINDIR)/$$(basename $$file .r); \
259+
done
260+
261+
262+
# Python scripts
263+
264+
python:
265+
@for file in $(PYTHONDIR)/*.py; do \
266+
cp $$file $(BINDIR)/$$(basename $$file .py); \
267+
done
268+
269+
270+
# re-branded tools [with permission]
271+
272+
external:
273+
cp $(shell which landsatlinks) $(BINDIR)/force-level1-landsat
274+
275+
241276
### dummy code for testing stuff
242277

243278
#dummy: temp cross aux higher src/dummy.c
244279
# $(G11) $(CFLAGS) $(GDAL) $(GSL) $(CURL) $(SPLITS) $(OPENCV) $(PYTHON) $(PYTHON2) $(RSTATS) -o $(TB)/dummy src/dummy.c $(TC)/*.o $(TA)/*.o $(TH)/*.o $(LDGDAL) $(LDGSL) $(LDCURL) $(LDSPLITS) $(LDOPENCV) $(LDPYTHON) $(LDRSTATS)
245280

246281

247-
### MISC
282+
# install the software
283+
284+
install: all
285+
find $(BINDIR) -type f -exec chmod 0755 {} +
286+
find $(BINDIR) -type d -exec chmod 0755 {} +
287+
cp -a $(BINDIR)/. $(INSTALLDIR)
248288

249-
#install_:
250-
# chmod 0755 $(TB)/*
251-
# chmod 0755 $(TU)/*
252-
# cp -a $(TB)/. $(BINDIR)
289+
290+
# clean up
253291

254292
clean:
255293
rm -rf $(OBJDIR) $(BINDIR)
@@ -267,35 +305,3 @@ clean:
267305
#misc: temp
268306
# $(foreach miscfiles,$(FORCE_MISC),\
269307
# $(shell cp $(DD)/$(miscfiles) -t $(TM)))
270-
271-
#bash: temp
272-
# cp $(DB)/force-info.sh $(TB)/force-info
273-
# cp $(DB)/force-cube.sh $(TB)/force-cube
274-
# cp $(DB)/force-level1-csd.sh $(TB)/force-level1-csd
275-
# cp $(DB)/force-level2.sh $(TB)/force-level2
276-
# cp $(DB)/force-mosaic.sh $(TB)/force-mosaic
277-
# cp $(DB)/force-pyramid.sh $(TB)/force-pyramid
278-
# cp $(DB)/force-procmask.sh $(TB)/force-procmask
279-
# cp $(DB)/force-tile-extent.sh $(TB)/force-tile-extent
280-
# cp $(DB)/force-magic-parameters.sh $(TB)/force-magic-parameters
281-
# cp $(DB)/force-level2-report.sh $(TB)/force-level2-report
282-
# cp $(DB)/force-init.sh $(TB)/force-init
283-
# cp $(DB)/force-datacube-size.sh $(TB)/force-datacube-size
284-
# cp $(DB)/force-unit-testing.sh $(TB)/force-unit-testing
285-
286-
#external: temp
287-
# cp $(shell which landsatlinks) $(TB)/force-level1-landsat
288-
289-
#python: temp
290-
# cp $(DP)/force-synthmix.py $(TB)/force-synthmix
291-
292-
#rstats: temp
293-
# cp $(DR)/force-sample-size.r $(TB)/force-sample-size
294-
# cp $(DR)/force-map-accuracy.r $(TB)/force-map-accuracy
295-
296-
#install: bash python rstats misc external install_ clean check
297-
298-
#build:
299-
# $(eval V := $(shell grep '#define _VERSION_' src/cross-level/const-cl.h | cut -d '"' -f 2 | sed 's/ /_/g'))
300-
# $(eval T :=$(shell date +"%Y%m%d%H%M%S"))
301-
# tar -czf force_v$(V)_$(T).tar.gz src bash python rstats misc external images docs Makefile LICENSE README.md

misc/force-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.12-dev:::2024-10-24_13:15:47
1+
3.7.12-dev:::2024-10-24_13:44:42

0 commit comments

Comments
 (0)