I'm trying to create a Makefile that works on both Windows and Linux. Running make clean
generates the following error:
process_begin: CreateProcess(NULL, rmdir /s /q D:\Documents\Programming\project\bin, ...) failed.
make: Makefile:13: pipe: No such file or directory
process_begin: CreateProcess(NULL, rmdir /s /q D:\Documents\Programming\project\obj, ...) failed.
make: Makefile:15: pipe: No such file or directory
The relevant parts of the Makefile are:
BIN_DIR=bin
OBJ_DIR=obj
SRC_DIR=src
ifeq ($(OS),Windows_NT)
RMDIR=$(shell rmdir /s /q $(subst /,\,$(abspath $1)))
else
RMDIR=$(shell rm -rf $(abspath $1))
endif
clean:
@echo "RM $(BIN_DIR)"
@$(call RMDIR,$(BIN_DIR))
@echo "RM $(OBJ_DIR)"
@$(call RMDIR,$(OBJ_DIR))
@echo "Done!"
.PHONY: clean
The project structure looks like this:
├─bin
├─obj
├─src
└─Makefile