Skip to content

Commit

Permalink
?Macros.sh: more close to make protocols,
Browse files Browse the repository at this point in the history
	plus comment fixes, plus improve codeflow.

`make` protocols:
	?`Macros.sh`:
		-`SUSUWU_BUILD_SOURCES()`: split into:
			+`SUSUWU_PROCESS_INCLUDES()`: `:%s/${CXX_SOURCE_PATH}Class*.hxx ${CXX_SOURCE_PATH}Macros.hxx/$@/`, plus comment howto use.
			+`SUSUWU_BUILD_SOURCES()`, plus comment howoto
			use.
		-`SUSUWU_SETUP_CXX_PROCESS_MINGW()`: split into;
			+`SUSUWU_PROCESS_MINGW()` (plus comment howto use),
			+`SUSUWU_SETUP_CXX()`.
		-`SUSUWU_SETUP_OUTPUT_DIRS()`: split into;
			+`SUSUWU_SETUP_OUTPUT()`: `:%s/"a/"${1}/`,
			+`SUSUWU_SETUP_BINDIR()`: `:%s/"\.\/bin\/"/${1}/`,
			+`SUSUWU_SETUP_OBJDIR()`: `:%s/"\.\/obj\/"/${1}/`,
			plus comment howto use.
	?`Macros.sh`, ?`build.sh`:
		-`SUSUWU_BUILD_SOURCES`: split into;
			+`SUSUWU_PROCESS_INCLUDES ${CXX_SOURCE_PATH}Class*.hxx ${CXX_SOURCE_PATH}Macros.hxx`
			+`SUSUWU_BUILD_SOURCES``
		-`SUSUWU_SETUP_CXX_PROCESS_MINGW`: split into;
			+`SUSUWU_PROCESS_MINGW $?` (plus comment howto use),
			+`SUSUWU_SETUP_CXX`.
		-`SUSUWU_SETUP_OUTPUT_DIRS`: split into;
			+`SUSUWU_SETUP_OUTPUT "a"`, +`SUSUWU_SETUP_BINDIR "./bin/"`, +`SUSUWU_SETUP_OBJDIR "./obj/"`.
			Is followup to: d025402 (...TODO: ...
            Remove our project-specific (local) values from the new `Macros.sh` functions,
	    have new functions more close to `make` protocols,
	    have `build.sh` call those functions with our project-specific (local) values.)
Comment fixes:
	?`Macros.sh`:
		?`SUSUWU_AFFIX_DOTSLASH()`: Usage example is now `BINDIR` (since `./` is used to execute.)
		?`SUSUWU_SETUP_CXX()`, ?`SUSUWU_SETUP_BUILD_FLAGS()`, ?`SUSUWU_PROCESS_RELEASE_DEBUG()`, ?`SUSUWU_PROCESS_CLEAN_REBUILD()`: comment how to use.
	?`build.sh`:
		?`SUSUWU_PROCESS_MINGW`, ?`SUSUWU_PROCESS_RELEASE_DEBUG`, ?`SUSUWU_PROCESS_CLEAN_REBUILD`: comment how to use.
	?`README.md`: ?`Special flags`: howto use.

Improved codeflow:
	?`build.sh`:
		-`SUSUWU_REBUILD_CTAGS()`, +`SUSUWU_BUILD_CTAGS()`.
		+`CXXFLAGS_SPECIAL`: For `README.md` flags.
		?`CXXFLAGS`: Now includes `CXXFLAGS_SPECIAL`.
		Replace duplicate code with `SUSUWU_SETUP_BUILD_FLAGS`.
	?`Macros.sh`:
		+`SUSUWU_BUILD_CTAGS`, plus comment howto use.
		?`SUSUWU_CLEAN_OUTPUT()`: Remove all build targets (as `make clean` does). Comment reason `-f` is omitted.
		?`SUSUWU_INCLUDE_SOURCES()`: typo fix: forgot to escape the '`' around `#include`.
		?`SUSUWU_BUILD_SOURCES()`: Replace mixed conditional formats with simple if block.
		?`SUSUWU_BUILD_SOURCES()`: Output `LD` error codes.

Is followup to: d025402 (Move generic code from ?`build.sh` to ?`Macros.sh).
Has to do with issue #18 (support more tools).

?`posts/VirusAnalysis.md`: include f2cf644 (`--mingw`/`SUSUWU_WIN32` regression fix, typos fix) (that commit forgot to update `posts/VirusAnalysis.md`:`classSysHexStrTests`)
  • Loading branch information
SwuduSusuwu committed Nov 19, 2024
1 parent d025402 commit 3ee82e4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 46 deletions.
74 changes: 46 additions & 28 deletions Macros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SUSUWU_DIR_SUFFIX_SLASH() { #/* Usage: `OBJDIR=$(SUSUWU_ENSURE_DIR_SLASH "$OBJDI
fi
echo "${DIR}" #/* return with slash */
}
SUSUWU_DIR_AFFIX_DOTSLASH() { #/* Usage: `OBJDIR=$(SUSUWU_ENSURE_DIR_SLASH "$OBJDIR") */
SUSUWU_DIR_AFFIX_DOTSLASH() { #/* Usage: `BINDIR=$(SUSUWU_ENSURE_DIR_SLASH "$BINDIR") */
DIR=$1
case "${DIR}" in
./*) #/* original has "./" */
Expand Down Expand Up @@ -48,13 +48,13 @@ SUSUWU_PRINT() { #/* Usage: `SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "$0 launch" */
echo "${LEVEL}${x}${SUSUWU_SH_CLOSE_}" >&2 #/* fd=2 is `std::cerr`/`stderr` */
}

SUSUWU_REBUILD_CTAGS() {
SUSUWU_BUILD_CTAGS() {
if command -v ctags > /dev/null; then
ctags -R
fi
}

SUSUWU_SETUP_CXX_PROCESS_MINGW() { #/* TODO: input args */
SUSUWU_PROCESS_MINGW() { #/* Usage: `SUSUWU_PROCESS_MINGW $?` */
CROSS_COMP=""
if [ "--mingw" = "${1}" -o "--mingw" = "${2}" ]; then
CROSS_COMP=" --mingw"
Expand All @@ -69,6 +69,11 @@ SUSUWU_SETUP_CXX_PROCESS_MINGW() { #/* TODO: input args */
SUSUWU_PRINT "${SUSUWU_SH_ERROR}" "\`x86_64-w64-mingw32-clang++ not found\`, \`x86_64-w64-mingw32-g++ not found\`. Do \`apt install llvm-mingw-w64\` or \`apt install mingw-w64\`."
exit 1
fi
fi
}
SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_OUTPUT "" SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
if [ ! -z ${CROSS_COMP} ]; then #/* if `--mingw`, */
return; #/* don't override `CXX`. */
elif command -v clang++ > /dev/null; then
CXX="clang++" #/* TODO: +` -Xclang -analyze -Xclang -analyzer-output=text` (got no extra outputs from this) */
CXXFLAGS_DEBUG="${CXXFLAGS_DEBUG} ${CXXFLAGS_FSAN}" #/* [`-fsan*` supports `g++`/`clang++`](https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind#tldr) */
Expand All @@ -83,7 +88,7 @@ SUSUWU_SETUP_CXX_PROCESS_MINGW() { #/* TODO: input args */
fi
}

SUSUWU_PROCESS_RELEASE_DEBUG() { #/* TODO: input args */
SUSUWU_PROCESS_RELEASE_DEBUG() { #/* Usage: `SUSUWU_PROCESS_RELEASE_DEBUG $? */
if [ "--release" = "${1}" -o "--release" = "${2}" ]; then
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${0}${CROSS_COMP} --release\` does not support profilers/debuggers (use \`${0}${CROSS_COMP} --debug\` for this)."
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_RELEASE}"
Expand All @@ -96,42 +101,49 @@ SUSUWU_PROCESS_RELEASE_DEBUG() { #/* TODO: input args */
ASAN_OPTIONS=abort_on_error=1:fast_unwind_on_malloc=0:detect_leaks=0 UBSAN_OPTIONS=print_stacktrace=1 #/* "For LLDB/GDB and to prevent very short stack traces and usually false leaks detection" */
fi
}
SUSUWU_SETUP_BUILD_FLAGS() {
SUSUWU_SETUP_BUILD_FLAGS() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_OUTPUT "" SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
LD="${CXX}"
CC="${CXX} -x c"
LDFLAGS="${LDFLAGS} ${CXXFLAGS}"
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_ANALYSIS}"
CCFLAGS="${CCFLAGS} ${CXXFLAGS}"
C_SOURCE_PATH=$(SUSUWU_DIR_SUFFIX_SLASH "${C_SOURCE_PATH}") #/* if inherit C_SOURCE_PATH, perhaps it lacks '/' */
CXX_SOURCE_PATH=$(SUSUWU_DIR_SUFFIX_SLASH "${CXX_SOURCE_PATH}") #/* if inherit CXX_SOURCE_PATH, perhaps it lacks '/' */
}

SUSUWU_SETUP_OUTPUT_DIRS() { #/* Usage: `SUSUWU_SETUP_OUTPUT_DIRS()` */
SUSUWU_SETUP_OUTPUT() { #/* Usage: `SUSUWU_SETUP_OUTPUT "YourProgram"` */
if [ -z ${CROSS_COMP} ]; then
OUTPUT="a.out"
OUTPUT="${1}.out"
else
OUTPUT="a.exe"
OUTPUT="${1}.exe"
fi
}
SUSUWU_SETUP_OBJDIR() { #/* Usage: `SUSUWU_SETUP_OBJDIR "./obj/"` */
if [ -z ${OBJDIR} ]; then
OBJDIR="./obj/"
OBJDIR="${1}"
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "To redirect \`${CXX} -c ... -o \${OBJDIR}\${OBJ}.o\` (which has \`OBJDIR=\"${OBJDIR}\"\`), execute \`OBJDIR=\"./obj/\"\` (where \"./obj/\" is a directory which you choose)."
else
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${CXX} -c ... -o \${OBJDIR}\` inherits local \`OBJDIR=\"${OBJDIR}\"\` until you execute \`unset OBJDIR\`."
fi
OBJDIR=$(SUSUWU_DIR_SUFFIX_SLASH "${OBJDIR}") #/* if inherit OBJDIR, perhaps it is without last '/' */
mkdir -p "${OBJDIR}"
}
SUSUWU_SETUP_BINDIR() { #/* Usage: `SUSUWU_SETUP_BINDIR "./bin/"` */
if [ -z ${BINDIR} ]; then
BINDIR="./bin/"
BINDIR="${1}"
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "To redirect \`${LD} ... -o \${BINDIR}${OUTPUT}\` (which has \`BINDIR=\"${BINDIR}\"\`), execute \`BINDIR=\"./bin/\"\` (where \"./bin/\" is a directory which you choose)."
else
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${LD} ... -o \${BINDIR}${OUTPUT}\` inherits local \`BINDIR=\"${BINDIR}\"\` until you execute \`unset BINDIR\`."
fi
C_SOURCE_PATH=$(SUSUWU_DIR_SUFFIX_SLASH "${C_SOURCE_PATH}") #/* if inherit C_SOURCE_PATH, perhaps it lacks '/' */
CXX_SOURCE_PATH=$(SUSUWU_DIR_SUFFIX_SLASH "${CXX_SOURCE_PATH}") #/* if inherit CXX_SOURCE_PATH, perhaps it lacks '/' */
OBJDIR=$(SUSUWU_DIR_SUFFIX_SLASH "${OBJDIR}") #/* if inherit OBJDIR, perhaps it is without last '/' */
BINDIR=$(SUSUWU_DIR_SUFFIX_SLASH "${BINDIR}") #/* if inherit BINDIR, perhaps it is without last '/' */
mkdir -p "${OBJDIR}" "${BINDIR}"
mkdir -p "${BINDIR}"
}
SUSUWU_CLEAN_OUTPUT() {
SUSUWU_CLEAN_OUTPUT() { #/* The `-f` flag is omitted in case `OBJDIR` or `BINDIR` is set to "../*/". */
rm ${OBJDIR}*.o
rm ${BINDIR}*.exe
rm ${BINDIR}*.out
}
SUSUWU_PROCESS_CLEAN_REBUILD() {
SUSUWU_PROCESS_CLEAN_REBUILD() { #/* Usage: `SUSUWU_PROCESS_CLEAN_REBUILD $?` */
if [ "--clean" = "${1}" -o "--clean" = "${2}" ]; then
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "Was called with \`${0}${CROSS_COMP} --clean\`, will remove intermediate objects + exit. Use \`${0}${CROSS_COMP} --rebuild\` to clean + continue."
SUSUWU_CLEAN_OUTPUT
Expand All @@ -143,23 +155,25 @@ SUSUWU_PROCESS_CLEAN_REBUILD() {
fi
}

SUSUWU_BUILD_SOURCES() {
if [ -e ${BINDIR}${OUTPUT} ]; then
BUILDNEW=false
else
BUILDNEW=true
fi
for SOURCE in ${CXX_SOURCE_PATH}Class*.hxx ${CXX_SOURCE_PATH}Macros.hxx; do
SUSUWU_PROCESS_INCLUDES() { #/* Usage: `SUSUWU_BUILD_SOURCES ${C_SOURCE_PATH}*.h ${CXX_SOURCE_PATH}*.hxx` */
for SOURCE in $@; do
OBJECT="${OBJDIR}$(basename ${SOURCE} .hxx).o" #/* `basename`'s second param removes suffix */
SRCCXX="${CXX_SOURCE_PATH}$(basename ${SOURCE} .hxx).cxx" #/* `basename`'s second param removes suffix */
if [ ${OBJECT} -ot ${SOURCE} -a -e ${SOURCE} ]; then #/* `&& [ -e ${SOURCE} ]` is: skip unless `${SOURCE}` exists. */
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${SOURCE}\` (which is a common `#include`) is newer than \`${OBJECT}\`, will rebuild all objects."
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${SOURCE}\` (which is a common \`#include\`) is newer than \`${OBJECT}\`, will rebuild all objects."
SUSUWU_CLEAN_OUTPUT
break
elif [ ! -e ${SRCCXX} ]; then #/* If `*.hxx` doesn't have `*.cxx` match, */
touch ${OBJECT}; #/* ... then produce `*.o` (for future tests.) */
fi
done
}
SUSUWU_BUILD_SOURCES() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_OUTPUT "" SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
if [ -e ${BINDIR}${OUTPUT} ]; then
BUILDNEW=false
else
BUILDNEW=true
fi
OBJECTLIST=""
set -x
#for SOURCE in ${C_SOURCE_PATH}*/*.c; do #/* The extra "*/" is since this just has vendored code (`rfc6234/`) */
Expand All @@ -182,15 +196,19 @@ SUSUWU_BUILD_SOURCES() {
${BUILDNEW} && ${LD} ${LDFLAGS}${OBJECTLIST} -o "${BINDIR}${OUTPUT}"
STATUS=$?
set +x
if [ 0 -eq ${STATUS} -o false = ${BUILDNEW} ]; then
${BUILDNEW} && SUSUWU_PRINT "${SUSUWU_SH_SUCCESS}" "produced \`${BINDIR}${OUTPUT}\` (`stat -c%s ${BINDIR}${OUTPUT}` bytes)."
${BUILDNEW} || SUSUWU_PRINT "${SUSUWU_SH_SUCCESS}" "reused \`${BINDIR}${OUTPUT}\` (`stat -c%s ${BINDIR}${OUTPUT}` bytes)."
if [ false = ${BUILDNEW} ]; then
SUSUWU_PRINT "${SUSUWU_SH_SUCCESS}" "reused \`${BINDIR}${OUTPUT}\` (`stat -c%s ${BINDIR}${OUTPUT}` bytes)."
return 0
elif [ 0 -eq ${STATUS} ]; then
SUSUWU_PRINT "${SUSUWU_SH_SUCCESS}" "produced \`${BINDIR}${OUTPUT}\` (`stat -c%s ${BINDIR}${OUTPUT}` bytes)."
else
SUSUWU_PRINT "${SUSUWU_SH_ERROR}" "\`${LD}\` returned status code ${STATUS}."
fi
return ${STATUS}
}

SUSUWU_TEST_OUTPUT() {
if [ 0 -eq ${STATUS} -o false = ${BUILDNEW} ]; then
if [ 0 -eq ${STATUS} ] || [ false = ${BUILDNEW} ]; then
${BINDIR}${OUTPUT}
STATUS=$?
if [ 0 -eq ${STATUS} ]; then
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Usage: [`./build.sh [OPTIONS]`](https://github.com/SwuduSusuwu/SubStack/blob/tru
- `./build.sh --debug` : includes frame-pointers/debug symbols (`-g`), includes `valgrind`-replacement tools (such as `-fsanitize=address`), optimizes with `-Og`.
- `./build.sh --release` : excludes `--debug` (`-DNDEBUG`), strips frame-pointers/symbols, optimizes with `-O2`.
- `./build.sh --mingw` : can mix with `--release` or `--debug`. Produces [_Portable Executable_](https://wikipedia.org/wiki/Portable_Executable) (`./bin/a.exe`), for _Windows_.
- Special flags (`vim build.sh` to use); other than `_PREFER_`/`_SKIP_`, most use more resources if set to `true`:
- Special flags (use `vim build.sh` to put into `CXXFLAGS_SPECIAL`); other than `_PREFER_`/`_SKIP_`, most use more resources if set to `true`:
- Custom `sh` (console) output:
- `-DSUSUWU_SH_PREFER_STDIO` to replace `std::cXXX << ...` with `fprintf(stdXXX, ...)`; default is `!defined(__cplusplus)`.
- `-DSUSUWU_SH_VERBOSE` to print diagnostic messages (`SUSUWU_SH_USE_FILE`, `SUSUEU_SH_USE_LINE`, `SUSUWU_NOTICE`, `SUSUWU_DEBUG`, `SUSUWU_DEBUGEXECUTE`, `SUSUWU_NOTICE_EXECUTE`, `SUSUWU_DEBUG_EXECUTE` all use `#if SUSUWU_SH_VERBOSE`); default is `!defined(NDEBUG)`.
Expand Down
29 changes: 14 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh
. ./Macros.sh #/* SUSUWU_BUILD_SOURCES() SUSUWU_PRINT() SUSUWU_PROCESS_CLEAN_REBUILD() SUSUWU_PROCESS_RELEASE_DEBUG() SUSUWU_SETUP_CXX_PROCESS_MINGW() SUSUWU_SETUP_OUTPUT_DIRS() SUSUWU_SH_* SUSUWU_TEST_OUTPUT() */
. ./Macros.sh #/* SUSUWU_BUILD_CTAGS SUSUWU_BUILD_SOURCES() SUSUWU_PRINT() SUSUWU_PROCESS_CLEAN_REBUILD() SUSUWU_PROCESS_MINGW() SUSUWU_PROCESS_RELEASE_DEBUG() SUSUWU_SETUP_BUILD_FLAGS() SUSUWU_SETUP_CXX() SUSUWU_SETUP_BINDIR() SUSUWU_SETUP_OBJDIR() SUSUWU_SETUP_OUTPUT() SUSUWU_SH_* SUSUWU_TEST_OUTPUT() */
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "Dual licenses: choose \"Creative Commons\" or \"Apache 2\" (allows all uses)."

if command -v ctags > /dev/null; then
ctags -R
fi
SUSUWU_BUILD_CTAGS #/* Usage: `apt-get install ctags` */

CXXFLAGS_SPECIAL="" #/* You can put special flags from `build.sh` into this to use. */
CXXFLAGS_ANALYSIS="-Wall -Wno-unused -Wno-unused-function -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers" #/*TODO: -`-Wno-*`, +`-Wpedantic`, +`-Werror` */
CXXFLAGS_RELEASE="-fomit-frame-pointer -DNDEBUG -O2" #/* without frame pointer (pointer used for stacktraces), without `assert(...)`/`SUSUWU_DEBUG(...)`/`SUSUWU_NOTICE(...)`, with optimization level 2 */
CXXFLAGS_DEBUG="-std=c++11 -g -Og" #/* in MSVC is `/Zi /Od`: symbols for `gdb`/`lldb` use, optimizations compatible with `-g`/`-fsan*` */
Expand All @@ -14,23 +13,23 @@ CXXFLAGS_DEBUG="${CXXFLAGS_DEBUG} -fno-omit-frame-pointer" #/* thus optimization
#CXXFLAGS_DEBUG="${CXXFLAGS_DEBUG} -fno-optimize-sibling-calls" #/* Don't inline functions. Does extra stacktraces. */
CXXFLAGS_FSAN="-fsanitize=address -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment"
#CXXFLAGS_FSAN="${CXXFLAGS_FSAN} -fsanitize=undefined" #/* causes 'cannot locate symbol "__ubsan_handle_function_type_mismatch_abort"' */
C_SOURCE_PATH="./c/"
CXX_SOURCE_PATH="./cxx/"

SUSUWU_SETUP_CXX_PROCESS_MINGW $@

SUSUWU_PROCESS_RELEASE_DEBUG $@
SUSUWU_PROCESS_MINGW $@ #/* Usage: `./build.sh --mingw` */
SUSUWU_SETUP_CXX

LD="${CXX}"
CC="${CXX} -x c"
LDFLAGS="${LDFLAGS} ${CXXFLAGS}"
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_ANALYSIS}"
CCFLAGS="${CCFLAGS} ${CXXFLAGS}"
C_SOURCE_PATH="./c/"
CXX_SOURCE_PATH="./cxx/"
SUSUWU_PROCESS_RELEASE_DEBUG $@ #/* Usage: `./build.sh --debug` or `./build.sh --release` */
SUSUWU_SETUP_BUILD_FLAGS

BUILDNEW=false
SUSUWU_SETUP_OUTPUT_DIRS
SUSUWU_PROCESS_CLEAN_REBUILD $@
SUSUWU_SETUP_OUTPUT "a"
SUSUWU_SETUP_OBJDIR "./obj/"
SUSUWU_SETUP_BINDIR "./bin/"
SUSUWU_PROCESS_CLEAN_REBUILD $@ #/* Usage: `./build.sh --clean` or `./build.sh --rebuild` */

SUSUWU_PROCESS_INCLUDES ${CXX_SOURCE_PATH}Class*.hxx ${CXX_SOURCE_PATH}Macros.hxx
SUSUWU_BUILD_SOURCES
STATUS=$?

Expand Down
6 changes: 4 additions & 2 deletions posts/VirusAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ const pid_t execvesFork(const std::vector<std::string> &argvS, const std::vector
}
exit(EXIT_FAILURE); /* execv*() is `SUSUWU_NORETURN`. NOLINT(concurrency-mt-unsafe) */
#else /* ndef SUSUWU_POSIX */
# undef ERROR /* undo `shlobj.h`'s `#define ERROR 0` */
undef ERROR /* undo `shlobj.h`'s `#define ERROR 0` */
SUSUWU_ERROR("execvesFork: {#ifndef SUSUWU_POSIX /* TODO: convert to win32 */}");
return -1;
#endif /* ndef SUSUWU_POSIX */
Expand All @@ -545,7 +545,6 @@ const int execves(const std::vector<std::string> &argvS, const std::vector<std::
return wstatus;
#else /* ndef SUSUWU_POSIX */
throw std::runtime_error(SUSUWU_ERRSTR(ERROR, "execves: {#ifndef SUSUWU_POSIX /* TODO: convert to win32 */}"));
# define ERROR 0 /* redo `shlobj.h`'s `#define ERROR 0` */
#endif /* ndef SUSUWU_POSIX */
}
Expand Down Expand Up @@ -619,6 +618,9 @@ static void classSysHexTests(const std::string &value) {
classSysHexOs(os, value);
if(2 != os.str().size()) {
throw std::runtime_error(SUSUWU_ERRSTR(ERROR, "classSysHexOs(os, value); " + std::to_string(value.size()) + " == value.size(); " + std::to_string(os.str().size()) + " == os.str().size();"));
#ifndef SUSUWU_POSIX
# define ERROR 0 /* redo `shlobj.h`'s `#define ERROR 0` */
#endif /* ndef SUSUWU_POSIX */
}
}
const bool classSysTests() {
Expand Down

0 comments on commit 3ee82e4

Please sign in to comment.