reorganized folder structure

This commit is contained in:
Derek Tan
2024-06-29 17:24:59 -04:00
parent 8fc5f3dcda
commit 33a076c750
5 changed files with 59 additions and 0 deletions

33
src/tools/Makefile Normal file
View File

@ -0,0 +1,33 @@
# Universal makefile for single C++ program
#
# Use gcc flag -MMD (user) or -MD (user/system) to generate dependencies among source files.
# Use make default rules for commonly used file-name suffixes and make variables names.
#
# % make [ a.out ]
########## Variables ##########
CXX = g++ # compiler
CXXFLAGS = -std=c++20 -g -Wall -MMD # compiler flags
MAKEFILE_NAME = ${firstword ${MAKEFILE_LIST}} # makefile name
SOURCES = $(wildcard *.cc) # source files (*.cc)
OBJECTS = ${SOURCES:.cc=.o} # object files forming executable
DEPENDS = ${OBJECTS:.o=.d} # substitute ".o" with ".d"
EXEC = a.out # executable name
########## Targets ##########
.PHONY : clean # not file names
${EXEC} : ${OBJECTS} # link step
${CXX} ${CXXFLAGS} $^ -o $@ # additional object files before $^
${OBJECTS} : ${MAKEFILE_NAME} # OPTIONAL : changes to this file => recompile
# make implicitly generates rules to compile C++ files that generate .o files
-include ${DEPENDS} # include *.d files containing program dependences
clean : # remove files that can be regenerated
rm -f ${DEPENDS} ${OBJECTS} ${EXEC}

View File

@ -0,0 +1 @@
--style=java -k3 -W3 -m0 -f -p -H --squeeze-lines=3 -xb -xf -xh -c --max-code-length=80 -xL -Y --indent=spaces=8

25
src/tools/compile Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Use this script to compile your .cc files in dependency order
# Arguments:
# $1 = name of file containing list of .cc files
# $2 = name of the output file
cxx="g++-11"
cxxflags="-std=c++20 -fmodules-ts -Wall -g"
if [ $# -lt 1 ]; then
echo "Usage: $0 list-filename [output-name]" 1>&2
exit 1
fi
if [ $# -eq 2 ]; then
name="-o $2"
fi
for x in $(cat $1); do
$cxx $cxxflags -c $x
done
$cxx *.o $name

BIN
src/tools/produceOutputs Executable file

Binary file not shown.

BIN
src/tools/runSuite Executable file

Binary file not shown.