mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 12:20:02 -04:00
fix: revert to basic makefile where all variables are set by Lua
Fixes #2463
This commit is contained in:
parent
6c9b80d73c
commit
6599887899
1 changed files with 9 additions and 52 deletions
|
|
@ -1,56 +1,13 @@
|
||||||
#
|
CC?=cc
|
||||||
# compile_parsers.makefile
|
CXX_STANDARD?=c++14
|
||||||
#
|
|
||||||
|
|
||||||
CXX_STANDARD ?= c++14
|
all: parser.so
|
||||||
CFLAGS ?= -Os -std=c99 -fPIC
|
|
||||||
CXXFLAGS ?= -Os -std=$(CXX_STANDARD) -fPIC
|
|
||||||
LDFLAGS ?= -shared
|
|
||||||
SRC_DIR ?= ./src
|
|
||||||
DEST_DIR ?= ./dest
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
parser.o: src/parser.c
|
||||||
SHELL := powershell.exe
|
$(CC) -c src/parser.c -std=c99 -Os -fPIC -I./src
|
||||||
.SHELLFLAGS := -NoProfile -command
|
|
||||||
CP := Copy-Item -Recurse -ErrorAction SilentlyContinue
|
|
||||||
MKDIR := New-Item -ItemType directory -ErrorAction SilentlyContinue
|
|
||||||
TARGET := parser.dll
|
|
||||||
rmf = Write-Output $(1) | foreach { if (Test-Path $$_) { Remove-Item -Force } }
|
|
||||||
else
|
|
||||||
CP := cp
|
|
||||||
MKDIR := mkdir -p
|
|
||||||
TARGET := parser.so
|
|
||||||
rmf = rm -rf $(1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(wildcard $(SRC_DIR)/*.cc),)
|
scanner.o: src/scanner.cc
|
||||||
LDFLAGS += -lstdc++
|
$(CC) -c src/scanner.cc -std=$(CXX_STANDARD) -Os -fPIC -I./src
|
||||||
endif
|
|
||||||
|
|
||||||
OBJECTS := parser.o
|
parser.so: parser.o scanner.o
|
||||||
|
$(CC) parser.o scanner.o -o parser.so -shared -lstdc++
|
||||||
ifneq ($(wildcard $(SRC_DIR)/scanner.*),)
|
|
||||||
OBJECTS += scanner.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(TARGET)
|
|
||||||
|
|
||||||
$(TARGET): $(OBJECTS)
|
|
||||||
$(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
|
|
||||||
|
|
||||||
%.o: $(SRC_DIR)/%.c
|
|
||||||
$(CC) -c $(CFLAGS) -I$(SRC_DIR) -o $@ $<
|
|
||||||
|
|
||||||
%.o: $(SRC_DIR)/%.cc
|
|
||||||
$(CC) -c $(CXXFLAGS) -I$(SRC_DIR) -o $@ $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(call rmf,$(TARGET) $(OBJECTS))
|
|
||||||
|
|
||||||
$(DEST_DIR):
|
|
||||||
@$(MKDIR) $(DEST_DIR)
|
|
||||||
|
|
||||||
install: $(TARGET) $(DEST_DIR)
|
|
||||||
$(CP) $(TARGET) $(DEST_DIR)/
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue