Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f0634a8
Added basis for testing framework.
janderland Nov 2, 2019
4eff885
Setup testing framework.
janderland Nov 4, 2019
377ae60
Made global config accept env vars.
janderland Nov 4, 2019
baff712
Got round trip working for Maker testing.
janderland Nov 4, 2019
9891ca2
Minor naming.
janderland Nov 4, 2019
f37d5d0
Added Files type for easy project creation.
janderland Nov 4, 2019
5237a0c
Added the ability to save or load args.
janderland Nov 4, 2019
e444401
Saving test data.
janderland Nov 6, 2019
a5a3452
Removed RunDeps.
janderland Nov 7, 2019
32dd506
Tidied up modules.
janderland Nov 23, 2019
264cd7e
Added messy workplace. Should cleanup later.
janderland Nov 28, 2019
de1050e
Dynamic config barely works.
janderland Dec 22, 2019
36931b9
Removed public macros.
janderland Dec 22, 2019
607feb7
Removed `parsedModule`.
janderland Dec 22, 2019
34ec522
Added `moduleName` function.
janderland Dec 22, 2019
7707990
Removed useless comments from function.
janderland Dec 22, 2019
488a714
Removed error checking & config files.
janderland Dec 22, 2019
fc167e7
Removed `log` function.
janderland Dec 22, 2019
7ba94b1
moduleName => modulePath.
janderland Dec 22, 2019
1551145
Quoted find parameter.
janderland Dec 22, 2019
5da5340
Removed checks for path existence.
janderland Dec 22, 2019
6e730e2
Created `parseModule` function.
janderland Dec 22, 2019
7981158
Test framework without `go test`.
janderland Dec 23, 2019
b45b254
Improved out/err logging.
janderland Dec 23, 2019
d476742
make.go -> makecmd.go
janderland Dec 23, 2019
0ebae3f
Removed old main test file.
janderland Dec 23, 2019
ed72210
makecmd.go -> cmd.go
janderland Dec 23, 2019
320250c
Improved File DSL.
janderland Dec 28, 2019
924d092
Add jsock test integration and fix critical bugs
claude Jan 7, 2026
579e8d5
Rename outputFile to ofile for brevity
claude Jan 8, 2026
83b140c
Merge implicit_configuration branch for convention-based builds
claude Jan 8, 2026
5193a89
Fix recursive include bug and update workflow for convention-based bu…
claude Jan 8, 2026
8e5cd15
Remove Go testing framework - GitHub Actions workflow is sufficient
claude Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/test-jsock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Test Maker with jsock

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++ make libncurses-dev

- name: Setup jsock with convention-based build
run: |
# Copy Maker makefile
cp makefile test-projects/jsock/makefile

# Create per-module makefiles (convention-based approach)
cat > test-projects/jsock/jsock/makefile <<'EOF'
moduleType = slib
moduleDeps =
moduleCompFlags =
moduleLinkFlags =
EOF

cat > test-projects/jsock/demos/chat/client/makefile <<'EOF'
moduleType = exec
moduleDeps = jsock
moduleCompFlags = -I .
moduleLinkFlags = -l ncurses
EOF

cat > test-projects/jsock/demos/chat/server/makefile <<'EOF'
moduleType = exec
moduleDeps = jsock
moduleCompFlags = -I .
moduleLinkFlags = -l ncurses
EOF

- name: Build jsock library
working-directory: test-projects/jsock
run: make jsock

- name: Build chat client
working-directory: test-projects/jsock
run: make demos/chat/client

# Note: Skipping server build due to compilation error in jsock code
# (missing #include <algorithm> in ParsingEndpoint.cpp)

- name: Verify build artifacts exist
run: |
ls -la test-projects/jsock/_build/
test -f test-projects/jsock/_build/jsock.lib
test -f test-projects/jsock/_build/demos/chat/client.out
echo "All build artifacts verified successfully!"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test-projects/jsock"]
path = test-projects/jsock
url = https://github.com/janderland/jsock.git
143 changes: 57 additions & 86 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
# GLOBAL CONFIG
###############

# Path(s) to configuration file(s).
configFiles=config.mkr


# Directory where all files generated by the build go.
buildDir=_build
buildDir ?= _build


# C++ Compiler Executable
# This executable is used to convert C++ source files into
# C++ object files.
cxx=g++
cxx ?= g++


# C++ Compiler Flags
Expand All @@ -34,37 +30,44 @@ cxx=g++
# NOTE: Flags responsible for header-dependency information
# are already included by this makefile. They shouldn't be
# added here.
cxxFlags=
cxxFlagsComp=
cxxFlagsLink=
cxxFlags ?=
cxxFlagsComp ?=
cxxFlagsLink ?=


# Path to the ar utility.
ar ?= ar


# Flags passed to the ar utility.
arFlags=rcs
arFlags ?= rcs


# Path to the rm utility.
rm ?=/bin/rm


# File extensions for the input files
sourceExt=cpp
sourceExt ?= cpp


# File extensions for the generated executables and
# static libraries.
execExt=out
slibExt=lib
execExt ?= out
slibExt ?= lib


# Set this variable to a non-empty string to turn off
# verbose output.
verbose=
verbose ?= true



# GLOBAL PROCESSING
###################

# Ensure all required global variables are defined.
requiredVars=buildDir cxx execExt slibExt
$(foreach v,$(requiredVars),$(if $($v),,$(error $v is required but not defined)))
# Let included makefiles know this is Maker.
isMaker=true


# Empty the .SUFFIXES variable to turn off
Expand Down Expand Up @@ -94,7 +97,7 @@ $1: cxxFlagsCompExtra = $3
$1: $2
@echo "Packaging $$@"
mkdir -p $$(dir $$@)
ar $$(arFlags) $4 $$@ $$^
$$(ar) $$(arFlags) $4 $$@ $$^
endef


Expand All @@ -109,7 +112,7 @@ $1: cxxFlagsCompExtra = $3
$1: $2
@echo "Linking $$@"
mkdir -p $$(dir $$@)
$$(cxx) $$(cxxFlags) $$(cxxFlagsLink) $4 $$^ -o $$@
$$(cxx) $$(cxxFlags) $$(cxxFlagsLink) $$^ -o $$@ $4
endef


Expand All @@ -126,11 +129,10 @@ endef
# Define Run Rule
# 1 - Rule Name
# 2 - Executable
# 3 - Depedencies
runRule=$(eval $(call runRuleTempl,$1,$2,$3))
runRule=$(eval $(call runRuleTempl,$1,$2))
define runRuleTempl
.PHONY: $1
$1: $2 $3
$1: $2
@echo "Running $$<"
$$<
endef
Expand All @@ -140,12 +142,7 @@ endef
# LOGGING MACROS
################

# Log - Normal
# 1 - Message
log=$(info $1)


# Log - Debug
# Log Debug Message
# 1 - Message
debug=$(if $(verbose),$(info $1))

Expand All @@ -154,35 +151,35 @@ debug=$(if $(verbose),$(info $1))
# METADATA MACROS
#################

# Check Path Exists
# 1 - Input path
checkPathExists=$(if $(shell test -d $1 && echo true),,$(error $1 isn't a directory))
# Module Path
# 1 - Module Makefile Path
modulePath=$(patsubst %/,%,$(dir $1))


# Check Path For 'At' Symbol ('@' isn't allowed in Maker paths)
# 1 - Input path
# 1 - Module Path
checkPathForAt=$(if $(findstring @,$1),$(error $1 contains the @ symbol))


# Runner Name
# 1 - Input path
# 1 - Module Path
rname=run@$1


# Input Source Files
# 1 - Input path
sources=$(shell find $1 -iname *.$(sourceExt))
# 1 - Module Path
sources=$(shell find $1 -iname '*.$(sourceExt)')


# Output Object Files
# 1 - Input path
# 1 - Module Path
objects=$(addprefix $(buildDir)/,$(patsubst %.cpp,%.obj,$(call sources,$1)))


# Output File Path
# 1 - Input path
# 1 - Module Path
# 2 - Type
file=$(buildDir)/$1.$(call fileExt,$2)
ofile=$(buildDir)/$1.$(call fileExt,$2)


# Output File Extension
Expand Down Expand Up @@ -218,7 +215,7 @@ Compile Flags : $4
Linker Flags : $5
Source Files : $(call sources,$1)
Object Files : $(call objects,$1)
Output File : $(call file,$1,$2)
Output File : $(call ofile,$1,$2)
endef


Expand All @@ -228,42 +225,42 @@ endef
# 3 - Dependencies
# 4 - Compile Flags
# 5 - Link/Package Flags
# 6 - Run Dependencies
module=$(eval $(call moduleTempl,$(strip $1),$(strip $2),$(strip $3),$(strip $4),$(strip $5),$(strip $6)))
module=$(eval $(call moduleTempl,$(strip $1),$(strip $2),$(strip $3),$(strip $4),$(strip $5)))
define moduleTempl
$(call debug,Defining module for $1)
$(call checkPathExists,$1)
$(call checkPathForAt,$1)

$(call debug,$(call formatMetadata,$1,$2,$3,$4,$5))
$(call debug,)

$(1)Type=$2
$(1)Deps=$3
$(1)CFlags=$4
$(1)LFlags=$5
$(1)RunDeps=$6
targets+=$1
endef


# Parse Module Makefile
# 1 - Module Makefile
parseModule=$(eval $(call parseModuleTempl,$1))
define parseModuleTempl
$(eval include $f)
$(call module,$(call modulePath,$f),$(moduleType),$(moduleDeps),$(moduleCompFlags),$(moduleLinkFlags))
endef


# Dependency Files
# 1 - Dependency input paths
depFiles=$(foreach v,$1,$(call file,$v,$($(v)Type)))
depFiles=$(foreach v,$1,$(call ofile,$v,$($(v)Type)))


# Define Module Rules
# 1 - Input Path
rules=$(eval $(call rulesTempl,$1,$($(1)Type),$($(1)Deps),$($(1)CFlags),$($(1)LFlags),$($(1)RunDeps)))
rules=$(eval $(call rulesTempl,$1,$($(1)Type),$($(1)Deps),$($(1)CFlags),$($(1)LFlags)))
define rulesTempl
# Define the file rule
$(call $(call fileRuleName,$2),$(call file,$1,$2),$(call objects,$1) $(call depFiles,$3),$4,$5)

# Define the alias rule
$(call aliasRule,$1,$(call file,$1,$2))

# Define the run rule (only for executables)
$(if $(filter exec,$2),$(call runRule,$(call rname,$1),$(call file,$1,$2),$6))
$(call $(call fileRuleName,$2),$(call ofile,$1,$2),$(call objects,$1) $(call depFiles,$3),$4,$5)
$(call aliasRule,$1,$(call ofile,$1,$2))
$(if $(filter exec,$2),$(call runRule,$(call rname,$1),$(call ofile,$1,$2)))
endef


Expand All @@ -277,40 +274,14 @@ headerDepFiles=$(shell if [ -d $(buildDir) ]; then find $(buildDir) -iname *.dep



# PUBLIC MACROS
###############

# Declare Module
# 0 - Type
# 1 - Input path
# 2 - Dependencies
# 3 - Compile Flags
# 4 - Link/Package Flags
moduleTypes=exec slib
$(foreach v,$(moduleTypes),$(eval $v=$$(call module,$$1,$$0,$$2,$$3,$$4)))



# LOAD METADATA
###############

# Parse Config File
# 1 - Config file path
parseConfig=$(call debug,Parsing $1)$(call debug,)\
$(eval tempFile=$(shell mktemp))\
$(shell perl -pe '$(parserCode)' < $1 > $(tempFile))\
$(eval include $(tempFile))
define parserCode
s/(?<!\\)#.*\n/\n/g;
s/(?<!;)\s*\n//g;
s/;\s*\n/\n/g;
endef


$(call debug,Configuration)
$(call debug,=============)

$(foreach f,$(configFiles),$(call parseConfig,$f))
moduleFiles=$(shell find . -iname makefile -mindepth 2 | cut -c3-)
$(foreach f,$(moduleFiles),$(call parseModule,$f))



Expand All @@ -322,13 +293,13 @@ $(foreach f,$(configFiles),$(call parseConfig,$f))
all: $(targets)

$(buildDir)/%.obj: %.cpp
$(call log,Compiling $<)
$(info,Compiling $<)
mkdir -p $(dir $@)
$(cxx) -c $(headerDepFlags) $(cxxFlags) $(cxxFlagsComp) $(cxxFlagsCompExtra) $< -o $@

clean:
$(call log,Cleaning)
rm -rf $(buildDir)
$(info,Cleaning)
$(rm) -rf $(buildDir)



Expand All @@ -341,7 +312,7 @@ else
$(call debug,Targets: $(targets))
$(call debug,)

$(foreach t,$(targets),$(eval $(call rules,$t)))
$(foreach t,$(targets),$(call rules,$t))

include $(headerDepFiles)

Expand Down
1 change: 1 addition & 0 deletions test-projects/jsock
Submodule jsock added at f17312