Skip to content

Instantly share code, notes, and snippets.

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 luislavena/1523942 to your computer and use it in GitHub Desktop.
Save luislavena/1523942 to your computer and use it in GitHub Desktop.
diff --git a/Makefile.in b/Makefile.in
index a3040b6..4cd53a8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,6 +12,7 @@ NULL = /dev/null
srcdir = @srcdir@
top_srcdir = $(srcdir)
hdrdir = $(srcdir)/include
+PLATFORM = @PLATFORM@
CC = @CC@
CPP = @CPP@
@@ -346,6 +347,8 @@ clean-capi distclean-capi realclean-capi:
@echo $(@:-capi=ing) capi
$(Q)$(RMALL) $(CAPIOUT)
+clean-platform:
+ -$(Q) $(RMDIR) $(PLATFORM) 2> /dev/null || true
ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
$(ECHO) compiling $@
diff --git a/common.mk b/common.mk
index 88a3552..124cde3 100644
--- a/common.mk
+++ b/common.mk
@@ -24,6 +24,7 @@ EXTCONF = extconf.rb
RBCONFIG = ./.rbconfig.time
LIBRUBY_EXTS = ./.libruby-with-ext.time
REVISION_H = ./.revision.time
+PLATFORM_D = ./$(PLATFORM)/.time
RDOCOUT = $(EXTOUT)/rdoc
CAPIOUT = doc/capi
ID_H_TARGET = -id.h-
@@ -424,7 +425,7 @@ install-prereq: $(CLEAR_INSTALLED_LIST) PHONY
clear-installed-list: PHONY
@> $(INSTALLED_LIST) set MAKE="$(MAKE)"
-clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-extout
+clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-extout clean-platform
clean-local:: PHONY
@$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
@$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
@@ -434,10 +435,11 @@ clean-golf: PHONY
@$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
clean-rdoc: PHONY
clean-capi: PHONY
+clean-platform: PHONY
clean-extout: PHONY
clean-docs: clean-rdoc clean-capi
-distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean-extout
+distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean-extout distclean-platform
distclean-local:: clean-local
@$(RM) $(MKFILES) yasmdata.rb *.inc
@$(RM) config.cache config.status config.status.lineno $(PRELUDES)
@@ -448,6 +450,7 @@ distclean-golf: clean-golf
distclean-rdoc: PHONY
distclean-capi: PHONY
distclean-extout: clean-extout
+distclean-platform: clean-platform
realclean:: realclean-ext realclean-local realclean-enc realclean-golf realclean-extout
realclean-local:: distclean-local
@@ -572,7 +575,12 @@ dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
ia64.$(OBJEXT): {$(VPATH)}ia64.s
$(CC) $(CFLAGS) -c $<
-win32.$(OBJEXT): {$(VPATH)}win32.c $(RUBY_H_INCLUDES)
+$(PLATFORM_D):
+ $(Q) $(MAKEDIRS) $(PLATFORM)
+ $(Q) $(ECHO) > $(PLATFORM_D)
+
+win32/win32.$(OBJEXT): {$(VPATH)}win32/win32.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
+$(PLATFORM)/file.$(OBJEXT): {$(VPATH)}$(PLATFORM)/file.c $(RUBY_H_INCLUDES) $(PLATFORM_D)
###
diff --git a/configure.in b/configure.in
index b9f3c79..e64135d 100644
--- a/configure.in
+++ b/configure.in
@@ -2589,7 +2589,8 @@ AS_CASE(["$target_os"],
fi
EXPORT_PREFIX=' '
DLDFLAGS="${DLDFLAGS}"' $(DEFFILE)'
- AC_LIBOBJ([win32])
+ AC_LIBOBJ([win32/win32])
+ PLATFORM="win32"
COMMON_LIBS=m
# COMMON_MACROS="WIN32_LEAN_AND_MEAN="
COMMON_HEADERS="winsock2.h windows.h"
@@ -2613,6 +2614,17 @@ AS_CASE(["$target_os"],
])])
MINIOBJS="$MINIDLNOBJ"
+: ${PLATFORM:=posix}
+AC_SUBST(PLATFORM)
+
+AS_CASE(["$PLATFORM"],
+[win32], [
+ AC_LIBOBJ([win32/file])
+ ],
+[
+ AC_LIBOBJ([posix/file])
+])
+
AS_CASE(["$THREAD_MODEL"],
[pthread], [AC_CHECK_HEADERS(pthread.h)],
[win32], [],
diff --git a/posix/file.c b/posix/file.c
new file mode 100644
index 0000000..9419518
--- /dev/null
+++ b/posix/file.c
@@ -0,0 +1 @@
+/* noop */
diff --git a/win32/file.c b/win32/file.c
new file mode 100644
index 0000000..9419518
--- /dev/null
+++ b/win32/file.c
@@ -0,0 +1 @@
+/* noop */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment