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 diff --git a/Makefile b/Makefile index 7caa565..85ea593 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- @@ -76,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) @@ -147,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) 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: 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