2014-01-23 23:29:50 -08:00
|
|
|
# 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)))
|
|
|
|
|
|
2014-01-21 10:20:35 -06:00
|
|
|
.PHONY: all clean test docs corelib
|
|
|
|
|
|
2014-01-23 23:29:50 -08:00
|
|
|
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 $@ $<
|
2014-01-21 10:20:35 -06:00
|
|
|
|
|
|
|
|
clean:
|
2014-01-23 23:29:50 -08:00
|
|
|
rm -rf build wren wrend
|
|
|
|
|
|
|
|
|
|
prep:
|
|
|
|
|
mkdir -p build/debug build/release
|
2014-01-21 10:20:35 -06:00
|
|
|
|
2014-01-23 23:29:50 -08:00
|
|
|
# Run the tests against the debug build of Wren.
|
|
|
|
|
test: wrend
|
|
|
|
|
@./script/test.py
|
2014-01-21 10:20:35 -06:00
|
|
|
|
2014-01-23 23:29:50 -08:00
|
|
|
# Generate the Wren site.
|
2014-01-21 10:20:35 -06:00
|
|
|
docs:
|
2014-01-23 23:29:50 -08:00
|
|
|
@./script/generate_docs.py --watch
|
2014-01-21 10:20:35 -06:00
|
|
|
|
2014-01-23 23:29:50 -08:00
|
|
|
# Take the contents of corelib.wren and copy them into src/wren_core.c.
|
2014-01-21 10:20:35 -06:00
|
|
|
corelib:
|
2014-01-23 23:29:50 -08:00
|
|
|
@./script/generate_corelib.py
|