2017-07-11 14:32:01 +00:00
|
|
|
# Package configuration
|
|
|
|
PROJECT = enry
|
2018-04-28 13:02:50 +00:00
|
|
|
COMMANDS = cmd/enry
|
2017-07-11 14:32:01 +00:00
|
|
|
|
|
|
|
# Including ci Makefile
|
2018-10-24 06:26:08 +00:00
|
|
|
CI_REPOSITORY ?= https://github.com/src-d/ci.git
|
|
|
|
CI_BRANCH ?= v1
|
|
|
|
CI_PATH ?= .ci
|
|
|
|
MAKEFILE := $(CI_PATH)/Makefile.main
|
2017-07-11 14:32:01 +00:00
|
|
|
$(MAKEFILE):
|
2018-10-24 06:26:08 +00:00
|
|
|
git clone --quiet --depth 1 -b $(CI_BRANCH) $(CI_REPOSITORY) $(CI_PATH);
|
2017-07-11 14:32:01 +00:00
|
|
|
-include $(MAKEFILE)
|
2017-06-27 08:42:46 +00:00
|
|
|
|
2017-10-16 06:33:00 +00:00
|
|
|
# Docsrv: configure the languages whose api-doc can be auto generated
|
|
|
|
LANGUAGES = go
|
|
|
|
# Docs: do not edit this
|
|
|
|
DOCS_REPOSITORY := https://github.com/src-d/docs
|
2017-10-17 05:07:08 +00:00
|
|
|
SHARED_PATH ?= $(shell pwd)/.docsrv-resources
|
2017-10-16 06:33:00 +00:00
|
|
|
DOCS_PATH ?= $(SHARED_PATH)/.docs
|
|
|
|
$(DOCS_PATH)/Makefile.inc:
|
|
|
|
git clone --quiet --depth 1 $(DOCS_REPOSITORY) $(DOCS_PATH);
|
|
|
|
-include $(DOCS_PATH)/Makefile.inc
|
|
|
|
|
2017-04-05 16:38:42 +00:00
|
|
|
LINGUIST_PATH = .linguist
|
2016-07-13 20:21:18 +00:00
|
|
|
|
2017-08-08 10:02:27 +00:00
|
|
|
# shared objects
|
|
|
|
RESOURCES_DIR=./.shared
|
|
|
|
LINUX_DIR=$(RESOURCES_DIR)/linux-x86-64
|
|
|
|
LINUX_SHARED_LIB=$(LINUX_DIR)/libenry.so
|
|
|
|
DARWIN_DIR=$(RESOURCES_DIR)/darwin
|
|
|
|
DARWIN_SHARED_LIB=$(DARWIN_DIR)/libenry.dylib
|
2019-06-01 17:47:13 +00:00
|
|
|
STATIC_LIB=$(RESOURCES_DIR)/libenry.a
|
2017-08-08 10:02:27 +00:00
|
|
|
HEADER_FILE=libenry.h
|
|
|
|
NATIVE_LIB=./shared/enry.go
|
|
|
|
|
2017-04-05 16:38:42 +00:00
|
|
|
$(LINGUIST_PATH):
|
2017-04-05 17:27:19 +00:00
|
|
|
git clone https://github.com/github/linguist.git $@
|
2017-04-05 16:38:42 +00:00
|
|
|
|
2017-07-11 14:32:01 +00:00
|
|
|
clean-linguist:
|
|
|
|
rm -rf $(LINGUIST_PATH)
|
|
|
|
|
2017-08-08 10:02:27 +00:00
|
|
|
clean-shared:
|
|
|
|
rm -rf $(RESOURCES_DIR)
|
|
|
|
|
|
|
|
clean: clean-linguist clean-shared
|
2017-06-27 08:42:46 +00:00
|
|
|
|
2017-04-05 16:38:42 +00:00
|
|
|
code-generate: $(LINGUIST_PATH)
|
2018-12-27 10:55:34 +00:00
|
|
|
mkdir -p data && \
|
2017-04-05 16:38:42 +00:00
|
|
|
go run internal/code-generator/main.go
|
2019-02-14 11:47:45 +00:00
|
|
|
ENRY_TEST_REPO="$${PWD}/.linguist" go test -v \
|
|
|
|
-run Test_GeneratorTestSuite \
|
|
|
|
./internal/code-generator/generator \
|
|
|
|
-testify.m TestUpdateGeneratorTestSuiteGold \
|
|
|
|
-update_gold
|
2017-04-05 16:38:42 +00:00
|
|
|
|
2017-06-28 11:01:36 +00:00
|
|
|
benchmarks: $(LINGUIST_PATH)
|
2018-12-27 10:55:34 +00:00
|
|
|
go test -run=NONE -bench=. && \
|
|
|
|
benchmarks/linguist-total.rb
|
2017-06-28 11:01:36 +00:00
|
|
|
|
|
|
|
benchmarks-samples: $(LINGUIST_PATH)
|
2018-12-27 10:55:34 +00:00
|
|
|
go test -run=NONE -bench=. -benchtime=5us && \
|
|
|
|
benchmarks/linguist-samples.rb
|
2017-06-28 11:01:36 +00:00
|
|
|
|
2018-12-27 10:55:34 +00:00
|
|
|
benchmarks-slow: $(LINGUIST_PATH)
|
|
|
|
mkdir -p benchmarks/output && \
|
|
|
|
go test -run=NONE -bench=. -slow -benchtime=100ms -timeout=100h > benchmarks/output/enry_samples.bench && \
|
|
|
|
benchmarks/linguist-samples.rb 5 > benchmarks/output/linguist_samples.bench
|
2017-08-08 10:02:27 +00:00
|
|
|
|
|
|
|
linux-shared: $(LINUX_SHARED_LIB)
|
|
|
|
|
|
|
|
darwin-shared: $(DARWIN_SHARED_LIB)
|
|
|
|
|
|
|
|
$(DARWIN_SHARED_LIB):
|
|
|
|
mkdir -p $(DARWIN_DIR) && \
|
2017-09-28 16:07:55 +00:00
|
|
|
CC="o64-clang" CXX="o64-clang++" CGO_ENABLED=1 GOOS=darwin go build -buildmode=c-shared -o $(DARWIN_SHARED_LIB) $(NATIVE_LIB) && \
|
2017-08-08 10:02:27 +00:00
|
|
|
mv $(DARWIN_DIR)/$(HEADER_FILE) $(RESOURCES_DIR)/$(HEADER_FILE)
|
|
|
|
|
|
|
|
$(LINUX_SHARED_LIB):
|
|
|
|
mkdir -p $(LINUX_DIR) && \
|
2019-04-11 21:25:27 +00:00
|
|
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=c-shared -o $(LINUX_SHARED_LIB) $(NATIVE_LIB) && \
|
2017-08-08 10:02:27 +00:00
|
|
|
mv $(LINUX_DIR)/$(HEADER_FILE) $(RESOURCES_DIR)/$(HEADER_FILE)
|
2018-12-27 10:55:34 +00:00
|
|
|
|
2019-06-01 17:47:13 +00:00
|
|
|
|
|
|
|
static: $(STATIC_LIB)
|
|
|
|
|
|
|
|
$(STATIC_LIB):
|
|
|
|
CGO_ENABLED=1 go build -buildmode=c-archive -o $(STATIC_LIB) $(NATIVE_LIB)
|
|
|
|
|
2018-12-27 10:55:34 +00:00
|
|
|
.PHONY: benchmarks benchmarks-samples benchmarks-slow
|