Generate makefile with gyp
- Add gyp submodule - Add script to generate makefile with gyp - Switch travis build to do this
This commit is contained in:
parent
86cc854c54
commit
67e008d15d
8 changed files with 30 additions and 50 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -1,4 +1,10 @@
|
|||
.idea
|
||||
|
||||
gyp-mac-tool
|
||||
Makefile
|
||||
*.Makefile
|
||||
*.target.mk
|
||||
*.xcodeproj
|
||||
|
||||
spec/run.out*
|
||||
*.xcodeproj
|
||||
*.xcodeproj
|
||||
out
|
||||
|
|
|
|||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +1,6 @@
|
|||
[submodule "externals/bandit"]
|
||||
path = externals/bandit
|
||||
url = https://github.com/joakimkarlsson/bandit.git
|
||||
[submodule "externals/gyp"]
|
||||
path = externals/gyp
|
||||
url = https://github.com/svn2github/gyp.git
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
language: cpp
|
||||
compiler:
|
||||
- clang
|
||||
script: make test
|
||||
install: script/bootstrap.sh
|
||||
script: script/ci.sh
|
||||
|
|
|
|||
47
Makefile
47
Makefile
|
|
@ -1,47 +0,0 @@
|
|||
.PHONY: all clean test debug valgrind
|
||||
|
||||
### install configuration ###
|
||||
CXX ?= clang++
|
||||
CC ?= clang
|
||||
RM ?= rm -f
|
||||
|
||||
### library configuration ###
|
||||
LIB_NAME = tree_sitter
|
||||
DIR = $(shell pwd)
|
||||
SOURCES = $(shell find src -name '*.cpp' -or -name '*.c')
|
||||
TESTS = $(shell find spec -name '*.cpp') $(shell find examples -name '*.c')
|
||||
SRC_OBJECTS = $(foreach file, $(SOURCES), $(basename $(file)).o)
|
||||
TEST_OBJECTS = $(foreach file, $(TESTS), $(basename $(file)).o)
|
||||
LIB_FILE = lib$(LIB_NAME).a
|
||||
TEST_BIN = spec/run.out
|
||||
|
||||
### build configuration ###
|
||||
CFLAGS ?= -Wall -g -m64
|
||||
CPPFLAGS ?= -Wall -std=c++11 -g -m64
|
||||
|
||||
### targets ###
|
||||
all: $(LIB_FILE)
|
||||
|
||||
$(LIB_FILE): $(SRC_OBJECTS)
|
||||
ar rcs $@ $^
|
||||
|
||||
test: $(TEST_BIN)
|
||||
./$<
|
||||
|
||||
$(TEST_BIN): $(TEST_OBJECTS) $(LIB_FILE)
|
||||
$(CXX) $(CPPFLAGS) $^ -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -Iinclude -Isrc/runtime -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CPPFLAGS) -Iinclude -Isrc/compiler -Isrc/runtime -Iexternals/bandit -Ispec -c $< -o $@
|
||||
|
||||
debug: $(TEST_BIN)
|
||||
gdb $<
|
||||
|
||||
valgrind: $(TEST_BIN)
|
||||
valgrind --track-origins=yes --dsymutil=yes $(TEST_BIN)
|
||||
|
||||
clean:
|
||||
$(RM) $(SRC_OBJECTS) $(TEST_OBJECTS) $(LIB_FILE) $(TEST_BIN)
|
||||
1
externals/gyp
vendored
Submodule
1
externals/gyp
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d277a083a05f5683a073ddd4991f5f79741b3f93
|
||||
7
script/bootstrap.sh
Executable file
7
script/bootstrap.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
git submodule update --init
|
||||
externals/gyp/gyp tree_sitter.gyp --depth .
|
||||
externals/gyp/gyp tree_sitter.gyp --depth . --format=make
|
||||
7
script/ci.sh
Executable file
7
script/ci.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
make compiler_specs
|
||||
out/Default/compiler_specs
|
||||
|
||||
make runtime_specs
|
||||
out/Default/runtime_specs
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
'include',
|
||||
'externals/bandit',
|
||||
'src/compiler',
|
||||
'spec',
|
||||
],
|
||||
'sources': [
|
||||
'<!@(ls spec/*.h spec/*.cpp)',
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
'include',
|
||||
'externals/bandit',
|
||||
'src/runtime',
|
||||
'spec',
|
||||
|
||||
# TODO - make separate spec helpers for runtime and compiler specs
|
||||
'src/compiler',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue