Fix Windows builds with cygwin.

This commit is contained in:
James Benton 2016-06-03 00:04:22 +01:00
parent ad6d357e80
commit f3c530f96c
4 changed files with 55 additions and 22 deletions

View File

@ -1,6 +1,13 @@
ifeq ($(OS),Windows_NT)
WUT_ROOT := $(shell cygpath -w ${CURDIR})
else
WUT_ROOT := $(CURDIR)
endif
TARGETS := crt rpl tools
export WUT_ROOT
all:
@for dir in $(TARGETS); do \
echo; \

View File

@ -1,6 +1,12 @@
.SUFFIXES:
TARGET := $(notdir $(CURDIR))
ifeq ($(OS),Windows_NT)
CUR_DIR := $(shell cygpath -w ${CURDIR})
else
CUR_DIR := $(CURDIR)
endif
TARGET := $(notdir $(CUR_DIR))
BUILD := build
SOURCE := ../common .
INCLUDE := .
@ -8,9 +14,9 @@ DATA := data
LIBS :=
ifneq ($(BUILD),$(notdir $(CURDIR)))
WUT_ROOT := $(CURDIR)/../..
WUT_ROOT := $(CUR_DIR)/../..
else
WUT_ROOT := $(CURDIR)/../../..
WUT_ROOT := $(CUR_DIR)/../../..
endif
include $(WUT_ROOT)/rules/ppc.mk
@ -21,10 +27,10 @@ ODEPS := stub.o lib.o
ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export BUILDDIR := $(CURDIR)/$(BUILD)
export OUTPUT := $(CUR_DIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CUR_DIR)/$(dir)) \
$(foreach dir,$(DATA),$(CUR_DIR)/$(dir))
export BUILDDIR := $(CUR_DIR)/$(BUILD)
export DEPSDIR := $(BUILDDIR)
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
@ -35,14 +41,14 @@ export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
-I$(CURDIR)/$(BUILD)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CUR_DIR)/$(dir)) \
-I$(CUR_DIR)/$(BUILD)
.PHONY: $(BUILD) clean
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CUR_DIR)/Makefile
clean:
@echo "[RM] $(notdir $(OUTPUT))"

View File

@ -4,6 +4,13 @@ ifeq ($(strip $(WUT_ROOT)),)
$(error "Please ensure WUT_ROOT is in your environment.")
endif
ifeq ($(OS),Windows_NT)
CUR_DIR := $(shell cygpath -w ${CURDIR})
WUT_ROOT := $(shell cygpath -w ${WUT_ROOT})
else
CUR_DIR := $(CURDIR)
endif
include $(WUT_ROOT)/rules/rpl.mk
TARGET := $(notdir $(CURDIR))
@ -19,10 +26,10 @@ LDFLAGS += -lgx2
ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export BUILDDIR := $(CURDIR)
export OUTPUT := $(CUR_DIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CUR_DIR)/$(dir)) \
$(foreach dir,$(DATA),$(CUR_DIR)/$(dir))
export BUILDDIR := $(CUR_DIR)
export DEPSDIR := $(BUILDDIR)
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
@ -38,14 +45,14 @@ endif
export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
-I$(CURDIR)/$(BUILD)
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CUR_DIR)/$(dir)) \
-I$(CUR_DIR)/$(BUILD)
.PHONY: $(BUILD) clean
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CUR_DIR)/Makefile
clean:
@echo "[RM] $(notdir $(OUTPUT))"

View File

@ -5,13 +5,26 @@ TARGETS := elf2rpl readrpl
ifeq ($(OS),Windows_NT)
all:
@echo "Please build tools with make-tools.bat"
install:
@echo "Please build tools with make-tools.bat"
ifeq (, $(shell which msbuild 2> /dev/null))
$(warning "msbuild not found, try building with make-tools.bat from a vcvars prompt.")
else
$(shell msbuild tools/tools.sln /p:Configuration=Release)
endif
clean:
@echo "Please build tools with make-tools.bat"
ifeq (, $(shell which msbuild 2> /dev/null))
$(shell msbuild tools/tools.sln /p:Configuration=Release /target:Clean)
else
$(warning "msbuild not found, try building with make-tools.bat from a vcvars prompt.")
endif
install: all
@mkdir -p $(WUT_ROOT)/bin
@for dir in $(TARGETS); do \
echo Installing $$dir; \
cp bin/$$dir $(WUT_ROOT)/bin; \
done
else
all:
@for dir in $(TARGETS); do \