diff options
| author | Dave Tang <davetingpongtang@gmail.com> | 2026-06-22 20:12:06 +0900 |
|---|---|---|
| committer | Dave Tang <davetingpongtang@gmail.com> | 2026-06-22 20:12:06 +0900 |
| commit | 319f10b1f20170adf7efa05938b6bb23584c4729 (patch) | |
| tree | f3a680d1a91c232f4b71912dbca4581056ad8477 /examples | |
GNU Make notes
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/dragmap/Makefile | 6 | ||||
| -rw-r--r-- | examples/dragmap/README.md | 47 | ||||
| -rwxr-xr-x | examples/dragmap/config.mk | 15 | ||||
| -rwxr-xr-x | examples/dragmap/run.sh | 11 | ||||
| -rwxr-xr-x | examples/dragmap/test1.sh | 3 | ||||
| -rwxr-xr-x | examples/dragmap/test2.sh | 5 | ||||
| -rwxr-xr-x | examples/dragmap/test3.sh | 7 | ||||
| -rw-r--r-- | examples/sge/Makefile | 25 | ||||
| -rwxr-xr-x | examples/sge/job1.sh | 14 | ||||
| -rwxr-xr-x | examples/sge/job2.sh | 15 | ||||
| -rwxr-xr-x | examples/sge/job3.sh | 15 | ||||
| -rw-r--r-- | examples/sge/submit.sh | 10 | ||||
| -rw-r--r-- | examples/visual/Makefile | 28 | ||||
| -rw-r--r-- | examples/visual/README.md | 35 | ||||
| -rw-r--r-- | examples/visual/out.png | bin | 0 -> 26851 bytes |
15 files changed, 236 insertions, 0 deletions
diff --git a/examples/dragmap/Makefile b/examples/dragmap/Makefile new file mode 100644 index 0000000..31dd118 --- /dev/null +++ b/examples/dragmap/Makefile @@ -0,0 +1,6 @@ +include config.mk +$(info BOOST_ROOT is $(BOOST_ROOT)) +$(info BOOST_INCLUDEDIR is $(BOOST_INCLUDEDIR)) +$(info BOOST_LIBRARYDIR is $(BOOST_LIBRARYDIR)) +$(info CPPFLAGS is $(CPPFLAGS)) +$(info LDFLAGS is $(LDFLAGS)) diff --git a/examples/dragmap/README.md b/examples/dragmap/README.md new file mode 100644 index 0000000..29ba382 --- /dev/null +++ b/examples/dragmap/README.md @@ -0,0 +1,47 @@ +# README + +Trying to build [DRAGMAP](https://github.com/Illumina/DRAGMAP) using updated +[Boost libraries](https://www.boost.org/). But the building process seems to be +using the outdated system Boost libraries in `/usr/include/boost/`. This is because I keep getting these errors: + + /usr/include/boost/program_options/detail/value_semantic.hpp:170: undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)' + +Here I examine the behaviour of the following environment variables: + +* `BOOST_ROOT` +* `BOOST_INCLUDEDIR` +* `BOOST_LIBRARYDIR` + +The required Boost libraries are: + + BOOST_LIBRARIES := system filesystem date_time thread iostreams regex program_options + +They reside in `/usr/include/boost169/boost/`; for example: + + /usr/include/boost169/boost/system + /usr/include/boost169/boost/filesystem + +Use `./run.sh` to run all the test scripts. + +## Notes + +* The `CPPFLAGS` macro is the one to use to specify `#include` directories. +* The `LDFLAGS` is normally set to contain options that are passed through to + the linker (so may include required libraries). + +[Probably the same +problem](https://stackoverflow.com/questions/62280304/yum-using-boost-1-69-instead-of-default-1-53-version-on-centos) +but I do not want to manually manipulate the symlinks by changing: + + /lib64/libboost_system.so -> libboost_system.so.1.53.0 + +to: + + /lib64/libboost_system.so -> libboost_system.so.1.69.0 + +## Fix + +Do not include `boost` in the DIR. For example: + + export BOOST_INCLUDEDIR=/usr/include/boost169 + export BOOST_LIBRARYDIR=/usr/lib64/boost169 diff --git a/examples/dragmap/config.mk b/examples/dragmap/config.mk new file mode 100755 index 0000000..433163a --- /dev/null +++ b/examples/dragmap/config.mk @@ -0,0 +1,15 @@ +BOOST_LIBRARIES := system filesystem date_time thread iostreams regex program_options + +ifneq (,$(BOOST_ROOT)) +BOOST_INCLUDEDIR?=$(BOOST_ROOT)/include +BOOST_LIBRARYDIR?=$(BOOST_ROOT)/lib +endif # ifneq (,$(BOOST_ROOT)) + +ifneq (,$(BOOST_INCLUDEDIR)) +CPPFLAGS += -I $(BOOST_INCLUDEDIR) +endif + +ifneq (,$(BOOST_LIBRARYDIR)) +LDFLAGS += -L $(BOOST_LIBRARYDIR) +endif +LDFLAGS += $(BOOST_LIBRARIES:%=-lboost_%) diff --git a/examples/dragmap/run.sh b/examples/dragmap/run.sh new file mode 100755 index 0000000..dcb38fd --- /dev/null +++ b/examples/dragmap/run.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +>&2 echo -e "Running test1\n" +./test1.sh +>&2 echo +>&2 echo -e "Running test2\n" +./test2.sh +>&2 echo +>&2 echo -e "Running test3\n" +./test3.sh +>&2 echo diff --git a/examples/dragmap/test1.sh b/examples/dragmap/test1.sh new file mode 100755 index 0000000..d9eae58 --- /dev/null +++ b/examples/dragmap/test1.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +make diff --git a/examples/dragmap/test2.sh b/examples/dragmap/test2.sh new file mode 100755 index 0000000..8bbc6ff --- /dev/null +++ b/examples/dragmap/test2.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export BOOST_ROOT=/usr/include/boost169/boost/ + +make diff --git a/examples/dragmap/test3.sh b/examples/dragmap/test3.sh new file mode 100755 index 0000000..99aca0d --- /dev/null +++ b/examples/dragmap/test3.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export BOOST_ROOT=/usr/include/boost169/ +export BOOST_INCLUDEDIR=/usr/include/boost169 +export BOOST_LIBRARYDIR=/usr/lib64/boost169 + +make diff --git a/examples/sge/Makefile b/examples/sge/Makefile new file mode 100644 index 0000000..e0baff6 --- /dev/null +++ b/examples/sge/Makefile @@ -0,0 +1,25 @@ +.PHONY: all +SHELL := /bin/bash + +FILES := a.txt b.txt c.txt d.txt +all: $(FILES) merged.txt 3.txt + +%.txt: + @echo "Generating: $@" + sleep 5 + echo $(basename $@) > $@ + +merged.txt: $(FILES) + cat $^ | sort > $@ + +1.txt: job1.sh + qsub $< + +2.txt: job2.sh 1.txt + qsub -hold_jid job1 $< + +3.txt: job3.sh 2.txt + qsub -hold_jid job2 $< + +clean: + rm -rf *.txt *.log diff --git a/examples/sge/job1.sh b/examples/sge/job1.sh new file mode 100755 index 0000000..4c72eb2 --- /dev/null +++ b/examples/sge/job1.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +#$ -S /bin/bash +#$ -N job1 +#$ -q all.q +#$ -cwd +#$ -l h_rt=01:00:00 +#$ -l h_rss=30720M,mem_free=30720M +#$ -j y +#$ -o job1.log + +export LANGUAGE=en_AU.UTF-8 + +sleep 10 +echo job1 > 1.txt diff --git a/examples/sge/job2.sh b/examples/sge/job2.sh new file mode 100755 index 0000000..fcd80d7 --- /dev/null +++ b/examples/sge/job2.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +#$ -S /bin/bash +#$ -N job2 +#$ -q all.q +#$ -cwd +#$ -l h_rt=01:00:00 +#$ -l h_rss=30720M,mem_free=30720M +#$ -j y +#$ -o job2.log + +export LANGUAGE=en_AU.UTF-8 + +sleep 10 +cat 1.txt > 2.txt +echo job2 >> 2.txt diff --git a/examples/sge/job3.sh b/examples/sge/job3.sh new file mode 100755 index 0000000..7243049 --- /dev/null +++ b/examples/sge/job3.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +#$ -S /bin/bash +#$ -N job3 +#$ -q all.q +#$ -cwd +#$ -l h_rt=01:00:00 +#$ -l h_rss=30720M,mem_free=30720M +#$ -j y +#$ -o job3.log + +export LANGUAGE=en_AU.UTF-8 + +sleep 10 +cat 2.txt > 3.txt +echo job3 >> 3.txt diff --git a/examples/sge/submit.sh b/examples/sge/submit.sh new file mode 100644 index 0000000..8adee71 --- /dev/null +++ b/examples/sge/submit.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#$ -S /bin/bash +#$ -N make_job +#$ -q all.q +#$ -pe make 4 +#$ -cwd +#$ -j y +#$ -o make_job.log + +make -j $NSLOTS diff --git a/examples/visual/Makefile b/examples/visual/Makefile new file mode 100644 index 0000000..6352ecb --- /dev/null +++ b/examples/visual/Makefile @@ -0,0 +1,28 @@ +# Simple Makefile Example + +# Default target +all: build test clean + +# Build target +build: compile link + @echo "Building the project..." + +# Compile target +compile: init + @echo "Compiling source files..." + +# Link target +link: init + @echo "Linking objects..." + +# Test target +test: build + @echo "Running tests..." + +# Clean target +clean: + @echo "Cleaning up..." + +# Init target (independent target) +init: + @echo "Initializing the build environment..." diff --git a/examples/visual/README.md b/examples/visual/README.md new file mode 100644 index 0000000..f497901 --- /dev/null +++ b/examples/visual/README.md @@ -0,0 +1,35 @@ +# README + +Creates a graph of dependencies from GNU-Make using [make2graph](https://github.com/lindenb/makefile2graph). + +```console +git clone https://github.com/lindenb/makefile2graph.git +cd makefile2graph +make +./make2graph --version +``` +``` +1.5.0 +``` + +Install `graphviz`. + +```console +sudo apt update +sudo apt install -y graphviz +``` + +`make` + +* -B, --always-make + * Unconditionally make all targets. +* -n, --just-print, --dry-run, --recon + * Print the commands that would be executed, but do not execute them (except in certain circumstances). +* -d + * Print debugging information in addition to normal processing. + +```console +make -Bnd | ./make2graph | dot -Tpng -o out.png +``` + + diff --git a/examples/visual/out.png b/examples/visual/out.png Binary files differnew file mode 100644 index 0000000..becc47e --- /dev/null +++ b/examples/visual/out.png |
