Merge branch 'verbose-make' of https://github.com/bfontaine/wren into bfontaine-verbose-make

This commit is contained in:
Bob Nystrom
2016-07-06 06:51:12 -07:00
2 changed files with 62 additions and 50 deletions

View File

@ -2,73 +2,79 @@
# compile Wren itself, it invokes util/wren.mk for the various configurations # compile Wren itself, it invokes util/wren.mk for the various configurations
# that Wren can be built with. # that Wren can be built with.
# Allows one to enable verbose builds with VERBOSE=1
V := @
ifeq ($(VERBOSE),1)
V :=
endif
# Executables are built to bin/. Libraries are built to lib/. # Executables are built to bin/. Libraries are built to lib/.
# A normal, optimized release build for the current CPU architecture. # A normal, optimized release build for the current CPU architecture.
release: release:
@ $(MAKE) -f util/wren.mk $(V) $(MAKE) -f util/wren.mk
@ cp bin/wren wren # For convenience, copy the interpreter to the top level. $(V) cp bin/wren wren # For convenience, copy the interpreter to the top level.
# A debug build for the current architecture. # A debug build for the current architecture.
debug: debug:
@ $(MAKE) -f util/wren.mk MODE=debug $(V) $(MAKE) -f util/wren.mk MODE=debug
# A release build of just the VM, both shared and static libraries. # A release build of just the VM, both shared and static libraries.
vm: vm:
@ $(MAKE) -f util/wren.mk vm $(V) $(MAKE) -f util/wren.mk vm
# A release build of the shared library for the VM. # A release build of the shared library for the VM.
shared: shared:
@ $(MAKE) -f util/wren.mk shared $(V) $(MAKE) -f util/wren.mk shared
# A release build of the shared library for the VM. # A release build of the shared library for the VM.
static: static:
@ $(MAKE) -f util/wren.mk static $(V) $(MAKE) -f util/wren.mk static
# Build all configurations. # Build all configurations.
all: debug release all: debug release
@ $(MAKE) -f util/wren.mk LANG=cpp $(V) $(MAKE) -f util/wren.mk LANG=cpp
@ $(MAKE) -f util/wren.mk MODE=debug LANG=cpp $(V) $(MAKE) -f util/wren.mk MODE=debug LANG=cpp
@ $(MAKE) -f util/wren.mk ARCH=32 $(V) $(MAKE) -f util/wren.mk ARCH=32
@ $(MAKE) -f util/wren.mk LANG=cpp ARCH=32 $(V) $(MAKE) -f util/wren.mk LANG=cpp ARCH=32
@ $(MAKE) -f util/wren.mk MODE=debug ARCH=32 $(V) $(MAKE) -f util/wren.mk MODE=debug ARCH=32
@ $(MAKE) -f util/wren.mk MODE=debug LANG=cpp ARCH=32 $(V) $(MAKE) -f util/wren.mk MODE=debug LANG=cpp ARCH=32
@ $(MAKE) -f util/wren.mk ARCH=64 $(V) $(MAKE) -f util/wren.mk ARCH=64
@ $(MAKE) -f util/wren.mk LANG=cpp ARCH=64 $(V) $(MAKE) -f util/wren.mk LANG=cpp ARCH=64
@ $(MAKE) -f util/wren.mk MODE=debug ARCH=64 $(V) $(MAKE) -f util/wren.mk MODE=debug ARCH=64
@ $(MAKE) -f util/wren.mk MODE=debug LANG=cpp ARCH=64 $(V) $(MAKE) -f util/wren.mk MODE=debug LANG=cpp ARCH=64
# Remove all build outputs and intermediate files. Does not remove downloaded # Remove all build outputs and intermediate files. Does not remove downloaded
# dependencies. Use cleanall for that. # dependencies. Use cleanall for that.
clean: clean:
@ rm -rf bin $(V) rm -rf bin
@ rm -rf build $(V) rm -rf build
@ rm -rf lib $(V) rm -rf lib
# Remove all build outputs, intermediate files, and downloaded dependencies. # Remove all build outputs, intermediate files, and downloaded dependencies.
cleanall: clean cleanall: clean
@ rm -rf deps $(V) rm -rf deps
# Run the tests against the debug build of Wren. # Run the tests against the debug build of Wren.
test: debug test: debug
@ $(MAKE) -f util/wren.mk MODE=debug test $(V) $(MAKE) -f util/wren.mk MODE=debug test
@ ./util/test.py $(suite) $(V) ./util/test.py $(suite)
benchmark: release benchmark: release
@ $(MAKE) -f util/wren.mk test $(V) $(MAKE) -f util/wren.mk test
@ ./util/benchmark.py -l wren $(suite) $(V) ./util/benchmark.py -l wren $(suite)
# Generate the Wren site. # Generate the Wren site.
docs: docs:
@ ./util/generate_docs.py $(V) ./util/generate_docs.py
# Continuously generate the Wren site. # Continuously generate the Wren site.
watchdocs: watchdocs:
@ ./util/generate_docs.py --watch $(V) ./util/generate_docs.py --watch
# Build the docs and copy them to a local "gh-pages" directory. # Build the docs and copy them to a local "gh-pages" directory.
gh-pages: docs gh-pages: docs
@ cp -r build/docs/. build/gh-pages $(V) cp -r build/docs/. build/gh-pages
# Build amalgamation of all Wren library files. # Build amalgamation of all Wren library files.
amalgamation: src/include/wren.h src/vm/*.h src/vm/*.c amalgamation: src/include/wren.h src/vm/*.h src/vm/*.c

View File

@ -36,6 +36,12 @@ TEST_SOURCES := $(wildcard test/api/*.c)
BUILD_DIR := build BUILD_DIR := build
# Allows one to enable verbose builds with VERBOSE=1
V := @
ifeq ($(VERBOSE),1)
V :=
endif
C_WARNINGS := -Wall -Wextra -Werror -Wno-unused-parameter C_WARNINGS := -Wall -Wextra -Werror -Wno-unused-parameter
# Wren uses callbacks heavily, so -Wunused-parameter is too painful to enable. # Wren uses callbacks heavily, so -Wunused-parameter is too painful to enable.
@ -151,80 +157,80 @@ test: $(BUILD_DIR)/test/$(WREN)
bin/$(WREN): $(OPT_OBJECTS) $(CLI_OBJECTS) $(MODULE_OBJECTS) $(VM_OBJECTS) \ bin/$(WREN): $(OPT_OBJECTS) $(CLI_OBJECTS) $(MODULE_OBJECTS) $(VM_OBJECTS) \
$(LIBUV) $(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS)"
@ mkdir -p bin $(V) mkdir -p bin
@ $(CC) $(CFLAGS) $^ -o $@ -lm $(LIBUV_LIBS) $(V) $(CC) $(CFLAGS) $^ -o $@ -lm $(LIBUV_LIBS)
# Static library. # Static library.
lib/lib$(WREN).a: $(OPT_OBJECTS) $(VM_OBJECTS) lib/lib$(WREN).a: $(OPT_OBJECTS) $(VM_OBJECTS)
@ printf "%10s %-30s %s\n" $(AR) $@ "rcu" @ printf "%10s %-30s %s\n" $(AR) $@ "rcu"
@ mkdir -p lib $(V) mkdir -p lib
@ $(AR) rcu $@ $^ $(V) $(AR) rcu $@ $^
# Shared library. # Shared library.
lib/lib$(WREN).$(SHARED_EXT): $(OPT_OBJECTS) $(VM_OBJECTS) lib/lib$(WREN).$(SHARED_EXT): $(OPT_OBJECTS) $(VM_OBJECTS)
@ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS) $(SHARED_LIB_FLAGS)" @ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS) $(SHARED_LIB_FLAGS)"
@ mkdir -p lib $(V) mkdir -p lib
@ $(CC) $(CFLAGS) -shared $(SHARED_LIB_FLAGS) -o $@ $^ $(V) $(CC) $(CFLAGS) -shared $(SHARED_LIB_FLAGS) -o $@ $^
# Test executable. # Test executable.
$(BUILD_DIR)/test/$(WREN): $(OPT_OBJECTS) $(MODULE_OBJECTS) $(TEST_OBJECTS) \ $(BUILD_DIR)/test/$(WREN): $(OPT_OBJECTS) $(MODULE_OBJECTS) $(TEST_OBJECTS) \
$(VM_OBJECTS) $(BUILD_DIR)/cli/modules.o $(BUILD_DIR)/cli/vm.o $(LIBUV) $(VM_OBJECTS) $(BUILD_DIR)/cli/modules.o $(BUILD_DIR)/cli/vm.o $(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS)"
@ mkdir -p $(BUILD_DIR)/test $(V) mkdir -p $(BUILD_DIR)/test
@ $(CC) $(CFLAGS) $^ -o $@ -lm $(LIBUV_LIBS) $(V) $(CC) $(CFLAGS) $^ -o $@ -lm $(LIBUV_LIBS)
# CLI object files. # CLI object files.
$(BUILD_DIR)/cli/%.o: src/cli/%.c $(CLI_HEADERS) $(MODULE_HEADERS) \ $(BUILD_DIR)/cli/%.o: src/cli/%.c $(CLI_HEADERS) $(MODULE_HEADERS) \
$(VM_HEADERS) $(LIBUV) $(VM_HEADERS) $(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)"
@ mkdir -p $(BUILD_DIR)/cli $(V) mkdir -p $(BUILD_DIR)/cli
@ $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $< $(V) $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $<
# Module object files. # Module object files.
$(BUILD_DIR)/module/%.o: src/module/%.c $(CLI_HEADERS) $(MODULE_HEADERS) \ $(BUILD_DIR)/module/%.o: src/module/%.c $(CLI_HEADERS) $(MODULE_HEADERS) \
$(VM_HEADERS) $(LIBUV) $(VM_HEADERS) $(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)"
@ mkdir -p $(BUILD_DIR)/module $(V) mkdir -p $(BUILD_DIR)/module
@ $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $< $(V) $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $<
# Aux object files. # Aux object files.
$(BUILD_DIR)/optional/%.o: src/optional/%.c $(VM_HEADERS) $(OPT_HEADERS) $(BUILD_DIR)/optional/%.o: src/optional/%.c $(VM_HEADERS) $(OPT_HEADERS)
@ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)"
@ mkdir -p $(BUILD_DIR)/optional $(V) mkdir -p $(BUILD_DIR)/optional
@ $(CC) -c $(CFLAGS) -Isrc/include -Isrc/vm -o $@ $(FILE_FLAG) $< $(V) $(CC) -c $(CFLAGS) -Isrc/include -Isrc/vm -o $@ $(FILE_FLAG) $<
# VM object files. # VM object files.
$(BUILD_DIR)/vm/%.o: src/vm/%.c $(VM_HEADERS) $(BUILD_DIR)/vm/%.o: src/vm/%.c $(VM_HEADERS)
@ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)"
@ mkdir -p $(BUILD_DIR)/vm $(V) mkdir -p $(BUILD_DIR)/vm
@ $(CC) -c $(CFLAGS) -Isrc/include -Isrc/optional -Isrc/vm -o $@ $(FILE_FLAG) $< $(V) $(CC) -c $(CFLAGS) -Isrc/include -Isrc/optional -Isrc/vm -o $@ $(FILE_FLAG) $<
# Test object files. # Test object files.
$(BUILD_DIR)/test/%.o: test/api/%.c $(OPT_HEADERS) $(MODULE_HEADERS) \ $(BUILD_DIR)/test/%.o: test/api/%.c $(OPT_HEADERS) $(MODULE_HEADERS) \
$(VM_HEADERS) $(TEST_HEADERS) $(LIBUV) $(VM_HEADERS) $(TEST_HEADERS) $(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)" @ printf "%10s %-30s %s\n" $(CC) $< "$(C_OPTIONS)"
@ mkdir -p $(dir $@) $(V) mkdir -p $(dir $@)
@ $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $< $(V) $(CC) -c $(CFLAGS) $(CLI_FLAGS) -o $@ $(FILE_FLAG) $<
# Download libuv. # Download libuv.
$(LIBUV_DIR)/build/gyp/gyp: util/libuv.py $(LIBUV_DIR)/build/gyp/gyp: util/libuv.py
@ ./util/libuv.py download $(V) ./util/libuv.py download
# Build libuv to a static library. # Build libuv to a static library.
$(LIBUV): $(LIBUV_DIR)/build/gyp/gyp util/libuv.py $(LIBUV): $(LIBUV_DIR)/build/gyp/gyp util/libuv.py
@ ./util/libuv.py build $(LIBUV_ARCH) $(V) ./util/libuv.py build $(LIBUV_ARCH)
# Wren modules that get compiled into the binary as C strings. # Wren modules that get compiled into the binary as C strings.
src/optional/wren_opt_%.wren.inc: src/optional/wren_opt_%.wren util/wren_to_c_string.py src/optional/wren_opt_%.wren.inc: src/optional/wren_opt_%.wren util/wren_to_c_string.py
@ printf "%10s %-30s %s\n" str $< @ printf "%10s %-30s %s\n" str $<
@ ./util/wren_to_c_string.py $@ $< $(V) ./util/wren_to_c_string.py $@ $<
src/vm/wren_%.wren.inc: src/vm/wren_%.wren util/wren_to_c_string.py src/vm/wren_%.wren.inc: src/vm/wren_%.wren util/wren_to_c_string.py
@ printf "%10s %-30s %s\n" str $< @ printf "%10s %-30s %s\n" str $<
@ ./util/wren_to_c_string.py $@ $< $(V) ./util/wren_to_c_string.py $@ $<
src/module/%.wren.inc: src/module/%.wren util/wren_to_c_string.py src/module/%.wren.inc: src/module/%.wren util/wren_to_c_string.py
@ printf "%10s %-30s %s\n" str $< @ printf "%10s %-30s %s\n" str $<
@ ./util/wren_to_c_string.py $@ $< $(V) ./util/wren_to_c_string.py $@ $<
.PHONY: all cli test vm .PHONY: all cli test vm