1
0
forked from Mirror/wren
Files
wren/Makefile

63 lines
1.4 KiB
Makefile
Raw Normal View History

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-04-26 08:07:03 -07:00
.PHONY: all clean test builtin docs watchdocs
2014-01-21 10:20:35 -06:00
2014-01-23 23:29:50 -08:00
all: release
2014-04-26 08:07:03 -07:00
clean:
rm -rf build wren wrend
prep:
mkdir -p build/debug build/release
2014-01-23 23:29:50 -08:00
# Debug build.
debug: prep wrend
2014-04-26 08:07:03 -07:00
# Debug command-line interpreter.
2014-01-23 23:29:50 -08:00
wrend: $(DEBUG_OBJECTS)
2014-11-26 14:03:05 -08:00
$(CC) $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -lm -o wrend $^
2014-01-23 23:29:50 -08:00
2014-04-26 08:07:03 -07:00
# Debug object files.
2014-01-23 23:29:50 -08:00
build/debug/%.o: src/%.c include/wren.h $(HEADERS)
$(CC) -c $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -o $@ $<
# Release build.
release: prep wren
2014-04-26 08:07:03 -07:00
# Release command-line interpreter.
2014-01-23 23:29:50 -08:00
wren: $(RELEASE_OBJECTS)
2014-11-26 14:03:05 -08:00
$(CC) $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -lm -o wren $^
2014-01-23 23:29:50 -08:00
2014-04-26 08:07:03 -07:00
# Release object files.
2014-01-23 23:29:50 -08:00
build/release/%.o: src/%.c include/wren.h $(HEADERS)
$(CC) -c $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -o $@ $<
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: debug
2014-02-02 10:30:58 -08:00
@./script/test.py $(suite)
2014-01-21 10:20:35 -06:00
2014-04-26 08:07:03 -07:00
# Take the contents of the scripts under builtin/ and copy them into their
# respective wren_<name>.c source files.
builtin:
@./script/generate_builtins.py
2014-01-23 23:29:50 -08:00
# Generate the Wren site.
2014-01-21 10:20:35 -06:00
docs:
2014-01-30 06:51:52 -08:00
@./script/generate_docs.py
# Continuously generate the Wren site.
watchdocs:
2014-01-23 23:29:50 -08:00
@./script/generate_docs.py --watch