diff options
Diffstat (limited to 'rbutil/libtools.make')
-rw-r--r-- | rbutil/libtools.make | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/rbutil/libtools.make b/rbutil/libtools.make index 7a125f98ea..c107e69bfd 100644 --- a/rbutil/libtools.make +++ b/rbutil/libtools.make | |||
@@ -37,8 +37,6 @@ TARGET_DIR ?= $(abspath .)/ | |||
37 | NATIVECC ?= gcc | 37 | NATIVECC ?= gcc |
38 | CC ?= gcc | 38 | CC ?= gcc |
39 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) | 39 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) |
40 | # use POSIX/C99 printf on windows | ||
41 | CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 | ||
42 | 40 | ||
43 | BINARY = $(OUTPUT) | 41 | BINARY = $(OUTPUT) |
44 | # when building a Windows binary add the correct file suffix | 42 | # when building a Windows binary add the correct file suffix |
@@ -50,6 +48,8 @@ else | |||
50 | ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) | 48 | ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) |
51 | BINARY = $(OUTPUT).exe | 49 | BINARY = $(OUTPUT).exe |
52 | COMPILETARGET = mingw | 50 | COMPILETARGET = mingw |
51 | # use POSIX/C99 printf on windows | ||
52 | CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 | ||
53 | else | 53 | else |
54 | ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) | 54 | ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) |
55 | COMPILETARGET = darwin | 55 | COMPILETARGET = darwin |
@@ -79,16 +79,9 @@ CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 | |||
79 | NATIVECC = gcc-4.0 | 79 | NATIVECC = gcc-4.0 |
80 | endif | 80 | endif |
81 | endif | 81 | endif |
82 | WINDRES = windres | ||
83 | 82 | ||
84 | BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) | 83 | BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) |
85 | |||
86 | ifdef RBARCH | ||
87 | ARCHFLAGS += -arch $(RBARCH) | ||
88 | OBJDIR = $(abspath $(BUILD_DIR)/$(RBARCH))/ | ||
89 | else | ||
90 | OBJDIR = $(abspath $(BUILD_DIR))/ | 84 | OBJDIR = $(abspath $(BUILD_DIR))/ |
91 | endif | ||
92 | 85 | ||
93 | all: $(BINARY) | 86 | all: $(BINARY) |
94 | 87 | ||
@@ -103,20 +96,20 @@ DEPS = $(addprefix $(OBJDIR),$(subst .c,.d,$(notdir $(SOURCES) $(LIBSOURCES)))) | |||
103 | 96 | ||
104 | # additional link dependencies for the standalone executable | 97 | # additional link dependencies for the standalone executable |
105 | # extra dependencies: libucl | 98 | # extra dependencies: libucl |
106 | LIBUCL = libucl$(RBARCH).a | 99 | LIBUCL = libucl.a |
107 | $(LIBUCL): $(OBJDIR)$(LIBUCL) | 100 | $(LIBUCL): $(OBJDIR)$(LIBUCL) |
108 | 101 | ||
109 | $(OBJDIR)$(LIBUCL): | 102 | $(OBJDIR)$(LIBUCL): |
110 | $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@ | 103 | $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@ |
111 | 104 | ||
112 | # building the standalone executable | 105 | # building the standalone executable |
113 | $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | 106 | $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_DIR)lib$(OUTPUT).a |
114 | @echo LD $@ | 107 | @echo LD $@ |
115 | $(SILENT)$(call mkdir,$(dir $@)) | 108 | $(SILENT)$(call mkdir,$(dir $@)) |
116 | # EXTRADEPS need to be built into OBJDIR. | 109 | # EXTRADEPS need to be built into OBJDIR. |
117 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ | 110 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ |
118 | $(OBJS) $(addprefix $(OBJDIR),$(EXTRADEPS)) \ | 111 | $(OBJS) $(addprefix $(OBJDIR),$(EXTRADEPS)) \ |
119 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(LDOPTS) | 112 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) lib$(OUTPUT).a $(addprefix $(OBJDIR),$(EXTRADEPS)) $(LDOPTS) |
120 | 113 | ||
121 | # common rules | 114 | # common rules |
122 | $(OBJDIR)%.o: | 115 | $(OBJDIR)%.o: |
@@ -125,10 +118,10 @@ $(OBJDIR)%.o: | |||
125 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $< | 118 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $< |
126 | 119 | ||
127 | # lib rules | 120 | # lib rules |
128 | lib$(OUTPUT)$(RBARCH).a: $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a | 121 | lib$(OUTPUT).a: $(TARGET_DIR)lib$(OUTPUT).a |
129 | lib$(OUTPUT)$(RBARCH): $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a | 122 | lib$(OUTPUT): $(TARGET_DIR)lib$(OUTPUT).a |
130 | 123 | ||
131 | $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) \ | 124 | $(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) \ |
132 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | 125 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) |
133 | # rules to build a DLL. Only works for W32 as target (i.e. MinGW toolchain) | 126 | # rules to build a DLL. Only works for W32 as target (i.e. MinGW toolchain) |
134 | dll: $(OUTPUT).dll | 127 | dll: $(OUTPUT).dll |
@@ -140,7 +133,7 @@ $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | |||
140 | -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def | 133 | -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def |
141 | 134 | ||
142 | # create lib file from objects | 135 | # create lib file from objects |
143 | $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | 136 | $(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) |
144 | @echo AR $(notdir $@) | 137 | @echo AR $(notdir $@) |
145 | $(SILENT)$(call mkdir,$(dir $@)) | 138 | $(SILENT)$(call mkdir,$(dir $@)) |
146 | $(SILENT)$(call rm,$@) | 139 | $(SILENT)$(call rm,$@) |