diff options
-rw-r--r-- | rbutil/libtools.make | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/rbutil/libtools.make b/rbutil/libtools.make index c107e69bfd..ab936f81bc 100644 --- a/rbutil/libtools.make +++ b/rbutil/libtools.make | |||
@@ -34,8 +34,8 @@ APPVERSION ?= $(shell $(TOP)/../tools/version.sh $(TOP)/..) | |||
34 | CFLAGS += -DVERSION=\"$(APPVERSION)\" | 34 | CFLAGS += -DVERSION=\"$(APPVERSION)\" |
35 | TARGET_DIR ?= $(abspath .)/ | 35 | TARGET_DIR ?= $(abspath .)/ |
36 | 36 | ||
37 | NATIVECC ?= gcc | 37 | CC := gcc |
38 | CC ?= gcc | 38 | CXX := g++ |
39 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) | 39 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) |
40 | 40 | ||
41 | BINARY = $(OUTPUT) | 41 | BINARY = $(OUTPUT) |
@@ -76,7 +76,6 @@ ARCHFLAGS += -arch ppc -arch i386 | |||
76 | # might need adjustment for older Xcode. | 76 | # might need adjustment for older Xcode. |
77 | CC = gcc-4.0 | 77 | CC = gcc-4.0 |
78 | CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 | 78 | CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 |
79 | NATIVECC = gcc-4.0 | ||
80 | endif | 79 | endif |
81 | endif | 80 | endif |
82 | 81 | ||
@@ -85,13 +84,13 @@ OBJDIR = $(abspath $(BUILD_DIR))/ | |||
85 | 84 | ||
86 | all: $(BINARY) | 85 | all: $(BINARY) |
87 | 86 | ||
88 | OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(notdir $(SOURCES)))) | 87 | OBJS := $(addsuffix .o,$(addprefix $(OBJDIR),$(notdir $(SOURCES)))) |
89 | LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(notdir $(LIBSOURCES)))) | 88 | LIBOBJS := $(addsuffix .o,$(addprefix $(OBJDIR),$(notdir $(LIBSOURCES)))) |
90 | 89 | ||
91 | # create dependency files. Make sure to use the same prefix as with OBJS! | 90 | # create dependency files. Make sure to use the same prefix as with OBJS! |
92 | $(foreach src,$(SOURCES) $(LIBSOURCES),$(eval $(addprefix $(OBJDIR),$(subst .c,.o,$(notdir $(src)))): $(src))) | 91 | $(foreach src,$(SOURCES) $(LIBSOURCES),$(eval $(addprefix $(OBJDIR),$(notdir $(src).o)): $(src))) |
93 | $(foreach src,$(SOURCES) $(LIBSOURCES),$(eval $(addprefix $(OBJDIR),$(subst .c,.d,$(notdir $(src)))): $(src))) | 92 | $(foreach src,$(SOURCES) $(LIBSOURCES),$(eval $(addprefix $(OBJDIR),$(notdir $(src).d)): $(src))) |
94 | DEPS = $(addprefix $(OBJDIR),$(subst .c,.d,$(notdir $(SOURCES) $(LIBSOURCES)))) | 93 | DEPS = $(addprefix $(OBJDIR),$(addsuffix .d,$(notdir $(SOURCES) $(LIBSOURCES)))) |
95 | -include $(DEPS) | 94 | -include $(DEPS) |
96 | 95 | ||
97 | # additional link dependencies for the standalone executable | 96 | # additional link dependencies for the standalone executable |
@@ -100,11 +99,11 @@ LIBUCL = libucl.a | |||
100 | $(LIBUCL): $(OBJDIR)$(LIBUCL) | 99 | $(LIBUCL): $(OBJDIR)$(LIBUCL) |
101 | 100 | ||
102 | $(OBJDIR)$(LIBUCL): | 101 | $(OBJDIR)$(LIBUCL): |
103 | $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@ | 102 | $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) CC=$(CC) $@ |
104 | 103 | ||
105 | # building the standalone executable | 104 | # building the standalone executable |
106 | $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_DIR)lib$(OUTPUT).a | 105 | $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_DIR)lib$(OUTPUT).a |
107 | @echo LD $@ | 106 | $(info LD $@) |
108 | $(SILENT)$(call mkdir,$(dir $@)) | 107 | $(SILENT)$(call mkdir,$(dir $@)) |
109 | # EXTRADEPS need to be built into OBJDIR. | 108 | # EXTRADEPS need to be built into OBJDIR. |
110 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ | 109 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ |
@@ -112,10 +111,15 @@ $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_ | |||
112 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) lib$(OUTPUT).a $(addprefix $(OBJDIR),$(EXTRADEPS)) $(LDOPTS) | 111 | $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) lib$(OUTPUT).a $(addprefix $(OBJDIR),$(EXTRADEPS)) $(LDOPTS) |
113 | 112 | ||
114 | # common rules | 113 | # common rules |
115 | $(OBJDIR)%.o: | 114 | $(OBJDIR)%.c.o: |
116 | @echo CC $< | 115 | $(info CC $<) |
117 | $(SILENT)$(call mkdir,$(dir $@)) | 116 | $(SILENT)$(call mkdir,$(dir $@)) |
118 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $< | 117 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -MMD -c -o $@ $< |
118 | |||
119 | $(OBJDIR)%.cpp.o: | ||
120 | $(info CXX $<) | ||
121 | $(SILENT)$(call mkdir,$(dir $@)) | ||
122 | $(SILENT)$(CROSS)$(CXX) $(ARCHFLAGS) $(CFLAGS) -MMD -c -o $@ $< | ||
119 | 123 | ||
120 | # lib rules | 124 | # lib rules |
121 | lib$(OUTPUT).a: $(TARGET_DIR)lib$(OUTPUT).a | 125 | lib$(OUTPUT).a: $(TARGET_DIR)lib$(OUTPUT).a |
@@ -127,26 +131,22 @@ $(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) \ | |||
127 | dll: $(OUTPUT).dll | 131 | dll: $(OUTPUT).dll |
128 | $(OUTPUT).dll: $(TARGET_DIR)$(OUTPUT).dll | 132 | $(OUTPUT).dll: $(TARGET_DIR)$(OUTPUT).dll |
129 | $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | 133 | $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) |
130 | @echo DLL $(notdir $@) | 134 | $(info DLL $(notdir $@)) |
131 | $(SILENT)$(call mkdir,$(dir $@)) | 135 | $(SILENT)$(call mkdir,$(dir $@)) |
132 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -shared -o $@ $^ \ | 136 | $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -shared -o $@ $^ \ |
133 | -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def | 137 | -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def |
134 | 138 | ||
135 | # create lib file from objects | 139 | # create lib file from objects |
136 | $(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) | 140 | $(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) |
137 | @echo AR $(notdir $@) | 141 | $(info AR $(notdir $@)) |
138 | $(SILENT)$(call mkdir,$(dir $@)) | 142 | $(SILENT)$(call mkdir,$(dir $@)) |
139 | $(SILENT)$(call rm,$@) | 143 | $(SILENT)$(call rm,$@) |
140 | $(SILENT)$(AR) rcs $@ $^ | 144 | $(SILENT)$(CROSS)$(AR) rcs $@ $^ |
141 | 145 | ||
142 | clean: | 146 | clean: |
143 | $(call rm, $(OBJS) $(OUTPUT) $(TARGET_DIR)lib$(OUTPUT)*.a $(OUTPUT).dmg) | 147 | $(call rm, $(OBJS) $(OUTPUT) $(TARGET_DIR)lib$(OUTPUT)*.a $(OUTPUT).dmg) |
144 | $(call rm, $(OUTPUT)-* i386 ppc $(OBJDIR)) | 148 | $(call rm, $(OUTPUT)-* i386 ppc $(OBJDIR)) |
145 | 149 | ||
146 | %.d: | ||
147 | $(SILENT)$(call mkdir,$(BUILD_DIR)) | ||
148 | $(SILENT)$(CC) -MG -MM -MT $(subst .d,.o,$@) $(CFLAGS) -o $(BUILD_DIR)/$(notdir $@) $< | ||
149 | |||
150 | # extra tools | 150 | # extra tools |
151 | BIN2C = $(TOP)/tools/bin2c | 151 | BIN2C = $(TOP)/tools/bin2c |
152 | $(BIN2C): | 152 | $(BIN2C): |
@@ -154,7 +154,7 @@ $(BIN2C): | |||
154 | 154 | ||
155 | # OS X specifics | 155 | # OS X specifics |
156 | $(OUTPUT).dmg: $(OUTPUT) | 156 | $(OUTPUT).dmg: $(OUTPUT) |
157 | @echo DMG $@ | 157 | $(info DMG $@) |
158 | $(SILENT)$(call mkdir,$(OUTPUT)-dmg)) | 158 | $(SILENT)$(call mkdir,$(OUTPUT)-dmg)) |
159 | $(SILENT)cp -p $(OUTPUT) $(OUTPUT)-dmg | 159 | $(SILENT)cp -p $(OUTPUT) $(OUTPUT)-dmg |
160 | $(SILENT)hdiutil create -srcfolder $(OUTPUT)-dmg $@ | 160 | $(SILENT)hdiutil create -srcfolder $(OUTPUT)-dmg $@ |