mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Reorganize makefile and scripts.
This commit is contained in:
53
Makefile
53
Makefile
@ -1,18 +1,53 @@
|
||||
# Compiler flags.
|
||||
CFLAGS = -std=c99 -Wall -Werror
|
||||
# TODO: Add -Wextra.
|
||||
DEBUG_CFLAGS = -O0 -DDEBUG
|
||||
RELEASE_CFLAGS = -Os
|
||||
|
||||
# Files.
|
||||
SOURCES = $(wildcard src/*.c)
|
||||
HEADERS = $(wildcard src/*.h)
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
DEBUG_OBJECTS = $(addprefix build/debug/, $(notdir $(OBJECTS)))
|
||||
RELEASE_OBJECTS = $(addprefix build/release/, $(notdir $(OBJECTS)))
|
||||
|
||||
.PHONY: all clean test docs corelib
|
||||
|
||||
all:
|
||||
gcc -Iinclude src/*.c -owren
|
||||
mkdir -p build/Release
|
||||
mv wren build/Release
|
||||
all: release
|
||||
|
||||
# Debug build.
|
||||
debug: prep wrend
|
||||
|
||||
wrend: $(DEBUG_OBJECTS)
|
||||
$(CC) $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -o wrend $^
|
||||
|
||||
build/debug/%.o: src/%.c include/wren.h $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -o $@ $<
|
||||
|
||||
# Release build.
|
||||
release: prep wren
|
||||
|
||||
wren: $(RELEASE_OBJECTS)
|
||||
$(CC) $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -o wren $^
|
||||
|
||||
build/release/%.o: src/%.c include/wren.h $(HEADERS)
|
||||
$(CC) -c $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf build wren wrend
|
||||
|
||||
test:
|
||||
@./runtests
|
||||
prep:
|
||||
mkdir -p build/debug build/release
|
||||
|
||||
# Run the tests against the debug build of Wren.
|
||||
test: wrend
|
||||
@./script/test.py
|
||||
|
||||
# Generate the Wren site.
|
||||
docs:
|
||||
@./make_docs
|
||||
@./script/generate_docs.py --watch
|
||||
|
||||
# Take the contents of corelib.wren and copy them into src/wren_core.c.
|
||||
corelib:
|
||||
@./make_corelib
|
||||
@./script/generate_corelib.py
|
||||
|
||||
Reference in New Issue
Block a user