Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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-
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 30 additions & 0 deletions config.mk.example
Original file line number Diff line number Diff line change
@@ -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