aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorkylo252 <59826753+kylo252@users.noreply.github.com>2022-01-25 09:35:18 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-01-25 13:41:01 +0100
commit24688a02bc2701306aff75902964c3615d3f6cbd (patch)
tree042741ff16454b433243f64e901a8c6a7d1bd8c4 /scripts
parenttest: use powershell by default (diff)
downloadnvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar.gz
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar.bz2
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar.lz
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar.xz
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.tar.zst
nvim-treesitter-24688a02bc2701306aff75902964c3615d3f6cbd.zip
refactor(makefile): better powershell handling
- add missing $(MKDIR) variable - create a simple function to allow running `make clean` without an error if a file doesn't exist
Diffstat (limited to 'scripts')
-rw-r--r--scripts/compile_parsers.makefile18
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/compile_parsers.makefile b/scripts/compile_parsers.makefile
index e03a6c5ea..a3d495885 100644
--- a/scripts/compile_parsers.makefile
+++ b/scripts/compile_parsers.makefile
@@ -10,15 +10,16 @@ DEST_DIR ?= ./dest
ifeq ($(OS),Windows_NT)
SHELL := powershell.exe
- .SHELLFLAGS := -NoProfile
- RM := Remove-Item -Force
- CP := Copy-Item -Recurse
- MKDIR := New-Item -ItemType directory
+ .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
- RM := rm -rf
CP := cp
+ MKDIR := mkdir -p
TARGET := parser.so
+ rmf = rm -rf $(1)
endif
ifneq ($(wildcard src/*.cc),)
@@ -39,13 +40,12 @@ $(TARGET): $(OBJECTS)
$(CC) -c $(CXXFLAGS) -I$(SRC_DIR) -o $@ $<
clean:
- $(foreach file, $(OBJECTS), $(RM) $(file))
- $(RM) $(TARGET)
+ $(call rmf,$(TARGET) $(OBJECTS))
$(DEST_DIR):
- test -d $(DEST_DIR) || $(MKDIR) $(DEST_DIR)
+ @$(MKDIR) $(DEST_DIR)
install: $(TARGET) $(DEST_DIR)
- $(CP) $^ $(DEST_DIR)
+ $(CP) $(TARGET) $(DEST_DIR)/
.PHONY: clean