summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--tools/knarc/Makefile12
2 files changed, 16 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 06655098..12f0414f 100644
--- a/Makefile
+++ b/Makefile
@@ -141,7 +141,7 @@ endif
.SECONDARY:
.DELETE_ON_ERROR:
.SECONDEXPANSION:
-.PHONY: all libs clean mostlyclean tidy tools $(TOOLDIRS) patch_mwasmarm arm9 arm7
+.PHONY: all libs clean mostlyclean tidy tools clean-tools $(TOOLDIRS) patch_mwasmarm arm9 arm7
MAKEFLAGS += --no-print-directory
@@ -150,10 +150,9 @@ ifeq ($(COMPARE),1)
@$(SHA1SUM) -c $(TARGET).sha1
endif
-clean: mostlyclean clean-fs
+clean: mostlyclean clean-fs clean-tools
$(MAKE) -C arm9 clean
$(MAKE) -C arm7 clean
- $(MAKE) -C tools/mwasmarm_patcher clean
clean-fs:
$(RM) $(filter %.narc %.arc,$(HOSTFS_FILES))
@@ -174,10 +173,13 @@ tools: $(TOOLDIRS)
$(TOOLDIRS):
@$(HOST_VARS) $(MAKE) -C $@
+clean-tools:
+ $(foreach tool,$(TOOLDIRS),$(MAKE) clean -C $(tool);)
+
$(MWASMARM): patch_mwasmarm
@:
-patch_mwasmarm:
+patch_mwasmarm: tools/mwasmarm_patcher
$(MWASMARM_PATCHER) $(MWASMARM)
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS))
diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile
index 5c4a469a..1c33e9f6 100644
--- a/tools/knarc/Makefile
+++ b/tools/knarc/Makefile
@@ -1,6 +1,7 @@
CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch
CFLAGS := -O2 -Wall -Wno-switch
+WSLENV ?= no
ifeq ($(OS),Windows_NT)
C_SRCS := fnmatch.c
LDFLAGS += -lstdc++fs
@@ -10,7 +11,9 @@ UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -lstdc++ -lc++ -lc
else
-LDFLAGS += -lstdc++fs -lstdc++ -lc++ -lc
+ifneq ($(WSLENV),)
+LDFLAGS += -lstdc++fs
+endif
endif
endif
CXX_SRCS := Source.cpp Narc.cpp
@@ -27,11 +30,16 @@ all: knarc
clean:
$(RM) knarc knarc.exe $(OBJS)
+ifeq ($(OS),Windows_NT)
knarc: $(OBJS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+ $(CXX) $^ -o $@ $(LDFLAGS) $(CXXFLAGS)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -c -o $@ $<
+else
+knarc: $(CXX_SRCS) $(HEADERS)
+ $(CXX) $(CXX_SRCS) -o $@ $(LDFLAGS) $(CXXFLAGS)
+endif