From 5adeb93babf77fa540818b11401659c9fe6bad80 Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 17:22:46 +0100 Subject: [PATCH 1/6] build: refactor Makefile to handle config.mk --- Makefile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7caa565..cb0ddcd 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ -#CONFIG_PROFILE=y -#CONFIG_X86_32=y -#CONFIG_ARM32=y -#CONFIG_WIN32=y -#CONFIG_SOFTFLOAT=y -#CONFIG_ASAN=y -#CONFIG_GPROF=y -CONFIG_SMALL=y +CONFIG_PROFILE ?= +CONFIG_X86_32 ?= +CONFIG_ARM32 ?= +CONFIG_WIN32 ?= +CONFIG_SOFTFLOAT ?= +CONFIG_ASAN ?= +CONFIG_GPROF ?= +CONFIG_SMALL ?= y # consider warnings as errors (for development) -#CONFIG_WERROR=y +CONFIG_WERROR ?= + +-include config.mk ifdef CONFIG_ARM32 CROSS_PREFIX=arm-linux-gnu- From c63fa522738cfc5c44050b8211689127463ed6b7 Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 17:23:33 +0100 Subject: [PATCH 2/6] build: add config.mk.example --- config.mk.example | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 config.mk.example diff --git a/config.mk.example b/config.mk.example new file mode 100644 index 0000000..e3d4e5b --- /dev/null +++ b/config.mk.example @@ -0,0 +1,30 @@ +# Local configuration file for mquickjs +# Uncomment or set variables to 'y' to enable, or 'n' to disable. + +# Enable generic profiling flags (-p) +#CONFIG_PROFILE=y + +# Force 32-bit x86 build +#CONFIG_X86_32=y + +# Force ARM 32-bit build (sets CROSS_PREFIX=arm-linux-gnu- and -mthumb) +#CONFIG_ARM32=y + +# Build for Windows (MinGW) +#CONFIG_WIN32=y + +# Use soft float (software floating point) +#CONFIG_SOFTFLOAT=y + +# Enable AddressSanitizer (ASAN) for debugging memory issues +#CONFIG_ASAN=y + +# Enable profiling (gprof) +#CONFIG_GPROF=y + +# Optimize for small code size (default: y) +# Set to 'n' to use -O2 instead of -Os +#CONFIG_SMALL=y + +# Treat compiler warnings as errors +#CONFIG_WERROR=y From aa0d1592b93ab19fb4e52d4c4621f642fc9d9b4e Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 17:38:05 +0100 Subject: [PATCH 3/6] build: update README with config.mk --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 177a8c5..aa5702f 100644 --- a/README.md +++ b/README.md @@ -346,6 +346,22 @@ the C stack usage is bounded. There is no abstract syntax tree. The bytecode is generated in one pass with several tricks to optimize it (QuickJS has several optimization passes). +#### Configuration + +The build configuration can be customized by creating a `config.mk` file. +You can copy the example configuration: + +```bash +cp config.mk.example config.mk +``` + +Then edit `config.mk` to enable or disable specific options (e.g. `CONFIG_ASAN=y` for debugging). +Alternatively, you can override options directly on the command line: + +```bash +make CONFIG_SMALL=n +``` + ## Tests and benchmarks Running the basic tests: From cf26689751b4078811de36a67606b5ed3d485711 Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 18:20:16 +0100 Subject: [PATCH 4/6] fix: add missing rempio2_test target in TEST_PROGS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cb0ddcd..58d5020 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ MQJS_BUILD_FLAGS=-m32 endif PROGS=mqjs$(EXE) example$(EXE) -TEST_PROGS=dtoa_test libm_test +TEST_PROGS=dtoa_test libm_test rempio2_test all: $(PROGS) From 2d4fb56c84355deada13927d94ad6ea72a2a8133 Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 18:25:52 +0100 Subject: [PATCH 5/6] build: remove non-existent targets from clean rule --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 58d5020..85ea593 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,6 @@ rempio2_test: tests/rempio2_test.o libm.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) clean: - rm -f *.o *.d *~ tests/*.o tests/*.d tests/*~ test_builtin.bin mqjs_stdlib mqjs_stdlib.h mquickjs_build_atoms mquickjs_atom.h mqjs_example example_stdlib example_stdlib.h $(PROGS) $(TEST_PROGS) + rm -f *.o *.d *~ tests/*.o tests/*.d tests/*~ test_builtin.bin mqjs_stdlib mqjs_stdlib.h mquickjs_atom.h example_stdlib example_stdlib.h $(PROGS) $(TEST_PROGS) -include $(wildcard *.d) From 54db4790e3a7aa840442f442cdccd2e3523cc765 Mon Sep 17 00:00:00 2001 From: acuD1 Date: Thu, 25 Dec 2025 18:34:40 +0100 Subject: [PATCH 6/6] chore: add .gitignore with config.mk, build artifacts and downloaded tests --- .gitignore | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67593d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Local configuration +config.mk + +# Build artifacts +*.o +*.d +*~ +*.exe +mqjs +example +mqjs_stdlib +mqjs_stdlib.h +mquickjs_atom.h +test_builtin.bin +dtoa_test +libm_test +rempio2_test + +# Example artifacts +example_stdlib +example_stdlib.h + +# Extra tests +mquickjs-extras.tar.xz +tests/octane/ +tests/dtoa_test.c +tests/dtoa_test.h +tests/gay-fixed.c +tests/gay-precision.c +tests/gay-shortest.c +tests/libm_test.c +tests/rempio2_test.c