Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Makefile fixes for win32

  • Loading branch information...
commit a68e27bb6548fd299237f634712d38e091a27ae5 1 parent 4b82e78
@kulp authored
View
1  .gitignore
@@ -15,3 +15,4 @@ tags
tmp/
*.dylib
*.so
+*.dll
View
17 Makefile
@@ -8,13 +8,16 @@ endif
ifeq ($(WIN32),1)
-include Makefile.Win32
else
- -include Makefile.$(shell uname -s)
+ OS = $(shell uname -s)
+ -include Makefile.$(OS)
ifeq ($(_32BIT),1)
CFLAGS += -m32
LDFLAGS += -m32
endif
endif
+INCLUDE_OS ?= src/os/$(OS)
+
CFLAGS += -std=c99
CFLAGS += -Wall -Wextra $(PEDANTIC)
@@ -38,7 +41,7 @@ CFILES = $(wildcard src/*.c) $(wildcard src/devices/*.c)
GENDIR = src/gen
VPATH += src src/devices $(GENDIR)
-INCLUDES += src $(GENDIR)
+INCLUDES += src $(GENDIR) $(INCLUDE_OS)
BUILD_NAME := $(shell git describe --tags --long --always)
CPPFLAGS += $(patsubst %,-D%,$(DEFINES)) \
@@ -51,10 +54,14 @@ PDEVICES = spidummy
PDEVOBJS = $(PDEVICES:%=%,dy.o)
PDEVLIBS = $(PDEVOBJS:%,dy.o=lib%$(DYLIB_SUFFIX))
+.PHONY: all win32 win64
all: tas$(EXE_SUFFIX) tsim$(EXE_SUFFIX) tld$(EXE_SUFFIX) $(PDEVLIBS)
win32: export _32BIT=1
-win32: export WIN32=1
-win32: all
+win32 win64: export WIN32=1
+# reinvoke make to ensure vars are set early enough
+win32 win64:
+ $(MAKE) $^
+
tas$(EXE_SUFFIX) tsim$(EXE_SUFFIX) tld$(EXE_SUFFIX): common.o
tas$(EXE_SUFFIX): $(GENDIR)/parser.o $(GENDIR)/lexer.o
tas$(EXE_SUFFIX) tsim$(EXE_SUFFIX): asm.o obj.o
@@ -66,7 +73,7 @@ tld$(EXE_SUFFIX): obj.o
asm.o: CFLAGS += -Wno-override-init
-%,dy.o: CFLAGS += -fPIC
+%,dy.o: CFLAGS += $(CFLAGS_PIC)
# used to apply to .o only but some make versions built directly from .c
tas$(EXE_SUFFIX) tsim$(EXE_SUFFIX) tld$(EXE_SUFFIX): DEFINES += BUILD_NAME='$(BUILD_NAME)'
View
1  Makefile.Darwin
@@ -2,3 +2,4 @@
DYLIB_SUFFIX = .dylib
CPPFLAGS += -D"PATH_SEPARATOR_CHAR='/'"
EXE_SUFFIX =
+CFLAGS_PIC += -fPIC
View
1  Makefile.Linux
@@ -3,3 +3,4 @@ tsim$(EXE_SUFFIX): LDLIBS += -ldl
DYLIB_SUFFIX = .so
CPPFLAGS += -D"PATH_SEPARATOR_CHAR='/'"
EXE_SUFFIX =
+CFLAGS_PIC += -fPIC
View
2  Makefile.Win32
@@ -3,6 +3,7 @@
DYLIB_SUFFIX = .dll
CPPFLAGS += -DPATH_SEPARATOR_CHAR="'\\\\'"
EXE_SUFFIX = .exe
+CFLAGS_PIC +=
ifeq ($(_32BIT),1)
CROSS_COMPILE ?= i686-w64-mingw32-
else
@@ -10,3 +11,4 @@ else
PEDANTIC =
CROSS_COMPILE ?= x86_64-w64-mingw32-
endif
+INCLUDE_OS = src/os/Win32
View
8 src/os/Linux/plugin.h
@@ -0,0 +1,8 @@
+#ifndef PLUGIN_H_
+#define PLUGIN_H_
+
+#include <dlfcn.h>
+#define EXPORT
+
+#endif
+
View
8 src/os/Win32/plugin.h
@@ -0,0 +1,8 @@
+#ifndef PLUGIN_H_
+#define PLUGIN_H_
+
+#include <windows.h>
+#define EXPORT __declspec(dllexport) __stdcall
+
+#endif
+
Please sign in to comment.
Something went wrong with that request. Please try again.