Skip to content

Instantly share code, notes, and snippets.

@k-takata
Created September 2, 2020 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-takata/b1564166fe7c868acaa60ecd4fb06a11 to your computer and use it in GitHub Desktop.
Save k-takata/b1564166fe7c868acaa60ecd4fb06a11 to your computer and use it in GitHub Desktop.
diff --git a/sakura_lang_en_US/Makefile b/sakura_lang_en_US/Makefile
index 0949faa3..4de6510b 100644
--- a/sakura_lang_en_US/Makefile
+++ b/sakura_lang_en_US/Makefile
@@ -23,6 +23,9 @@ endif
# If empty, it will be output to the default directory.
OUTDIR =
+# The directory where sakura_core is built.
+COREBUILDDIR =
+
ifeq ($(SHELL),sh.exe)
# If cmd.exe is used as a shell.
MKDIR = md
@@ -68,10 +71,10 @@ DEFINES= \
LIBS= \
-static \
-shared \
- -mwindows
+ -s
dll = $(or $(OUTDIR),.)/sakura_lang_en_US.dll
-sakura_rc = ../sakura_core/sakura_rc.o
+sakura_rc = $(or $(COREBUILDDIR),$(SRCDIR)/../sakura_core)/sakura_rc.o
SRCS = $(wildcard $(SRCDIR)/*.rc)
OBJS = $(SRCS:$(SRCDIR)/%.rc=%.o)
@@ -81,14 +84,11 @@ all: $(dll)
$(dll): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $@
-$(sakura_rc): ../sakura_core/Makefile
-ifneq ($(SRCDIR),.)
- -$(MKDIR) $(subst /,$(DIRSEP),$(@D)) > $(DEVNULL) 2>&1
-endif
- $(MAKE) -f $< -C $(@D) $(@F)
+$(sakura_rc): $(SRCDIR)/../sakura_core/Makefile
+ $(MAKE) -f $< -C $(realpath $(@D)) $(@F)
sakura_lang_rc.o: sakura_lang_rc.rc $(sakura_rc)
- $(RC) -c utf-8 --language=0409 $(DEFINES) -I../sakura_core -I$(SRCDIR)/../sakura_core $< -o $@
+ $(RC) -c utf-8 --language=0409 $(DEFINES) -I$(COREBUILDDIR) -I$(SRCDIR)/../sakura_core $< -o $@
clean:
-$(RM) $(subst /,$(DIRSEP),$(dll) $(OBJS))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment