Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add amalgamation Makefile target #949

Merged
merged 2 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,10 @@ jobs:
make
- name: create amalgamation
run: |
build/qjs amalgam.js $RUNNER_TEMP/quickjs-amalgam.c
make amalgam
- name: build amalgamation
run: |
unzip -d $RUNNER_TEMP build/quickjs-amalgam.zip
cc -Wall -I. -o $RUNNER_TEMP/run-test262.o -c run-test262.c
cc -Wall -I/ -DQJS_BUILD_LIBC -o $RUNNER_TEMP/quickjs-amalgam.o -c $RUNNER_TEMP/quickjs-amalgam.c
cc -o $RUNNER_TEMP/run-test262 $RUNNER_TEMP/run-test262.o $RUNNER_TEMP/quickjs-amalgam.o -lm
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ jobs:
cd build
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
make -j$(getconf _NPROCESSORS_ONLN)
(cd .. && build/qjs amalgam.js build/quickjs-amalgam.c)
cp ../quickjs.h .
zip -9 quickjs-amalgam.zip quickjs-amalgam.c quickjs.h
make -C .. amalgam # writes build/quickjs-amalgam.zip
mv qjs qjs-darwin
mv qjsc qjsc-darwin
- name: check
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ endif

all: $(QJS)

amalgam: TEMP := $(shell mktemp -d)
amalgam: $(QJS)
$(QJS) amalgam.js $(TEMP)/quickjs-amalgam.c
cp quickjs.h quickjs-libc.h $(TEMP)
cd $(TEMP) && zip -9 quickjs-amalgam.zip quickjs-amalgam.c quickjs.h quickjs-libc.h
cp $(TEMP)/quickjs-amalgam.zip $(BUILD_DIR)

fuzz:
clang -g -O1 -fsanitize=address,undefined,fuzzer -o fuzz fuzz.c
./fuzz
Expand Down Expand Up @@ -117,4 +124,4 @@ unicode_gen: $(BUILD_DIR)
libunicode-table.h: unicode_gen
$(BUILD_DIR)/unicode_gen unicode $@

.PHONY: all ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
.PHONY: all amalgam ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
Loading