| 1 |
# -*- Makefile -*- |
| 2 |
# VxWorks 6.2 |
| 3 |
|
| 4 |
#### Notes: |
| 5 |
#### 1) This file requires that the WIND_BASE and WIND_HOST_TYPE environment |
| 6 |
#### variables be set. If the target CPU is not SIMNT, then your CPU |
| 7 |
#### environment variable must be set. |
| 8 |
#### 2) If you have problems with munch output not being compilable |
| 9 |
#### because it contains identifiers with ".", e.g., ".cpp", in them: |
| 10 |
#### add a global variable or function to that .cpp file. See |
| 11 |
#### ace/IOStream_T.cpp for an explanation and example. |
| 12 |
#### 3) The TOOL environment variable may be set to "diab" (default is "gnu"). |
| 13 |
#### 4) If perl is not on your path, you'll also need to set your PERL_PATH |
| 14 |
#### environment variable to the full path to perl. |
| 15 |
|
| 16 |
VXWORKS = 1 |
| 17 |
CROSS-COMPILE = 1 |
| 18 |
|
| 19 |
debug ?= 1 |
| 20 |
optimize ?= 1 |
| 21 |
threads ?= 1 |
| 22 |
rtp ?= 1 |
| 23 |
ifeq ($(rtp),0) |
| 24 |
pthread ?= 0 |
| 25 |
else |
| 26 |
pthread ?= 1 |
| 27 |
endif |
| 28 |
xerces ?= 0 |
| 29 |
aio ?= 0 |
| 30 |
versioned_so ?= 0 |
| 31 |
|
| 32 |
ifeq ($(static_libs),1) |
| 33 |
shared_libs = 0 |
| 34 |
else |
| 35 |
static_libs = 0 |
| 36 |
endif |
| 37 |
ifeq ($(static_libs_only),1) |
| 38 |
shared_libs = 0 |
| 39 |
endif |
| 40 |
|
| 41 |
# VxWorks doesn't have rwho |
| 42 |
rwho = 0 |
| 43 |
|
| 44 |
ifeq (,$(WIND_BASE)) |
| 45 |
default: |
| 46 |
@ERROR: you must set your WIND_BASE environment variable |
| 47 |
endif # WIND_BASE |
| 48 |
|
| 49 |
ifeq (,$(WIND_HOST_TYPE)) |
| 50 |
default: |
| 51 |
@ERROR: you must set your WIND_HOST_TYPE environment variable |
| 52 |
endif # WIND_HOST_TYPE |
| 53 |
|
| 54 |
ifeq ("$(WIND_HOST_TYPE)","x86-win32") |
| 55 |
vxworks_ntbuild ?= 0 |
| 56 |
mingw32 ?= 1 |
| 57 |
lacks_touch ?= 0 |
| 58 |
PWD=$(subst \,/,$(shell pwd)) |
| 59 |
ACE_ROOT:=$(subst \,/,$(ACE_ROOT)) |
| 60 |
TAO_ROOT:=$(subst \,/,$(TAO_ROOT)) |
| 61 |
HOST_ROOT:=$(subst \,/,$(HOST_ROOT)) |
| 62 |
override RM=rm -f |
| 63 |
endif # x86-win32 |
| 64 |
|
| 65 |
ifneq (,$(HOST_ROOT)) |
| 66 |
TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf |
| 67 |
ifeq ("$(WIND_HOST_TYPE)","x86-win32") |
| 68 |
TAO_IDL = $(HOST_ROOT)/bin/tao_idl.exe |
| 69 |
else |
| 70 |
TAO_IDL = $(HOST_ROOT)/bin/tao_idl |
| 71 |
endif |
| 72 |
TAO_IDL_DEP = $(TAO_IDL) |
| 73 |
endif |
| 74 |
|
| 75 |
HOST_DIR = $(WIND_BASE)/host/$(WIND_HOST_TYPE) |
| 76 |
|
| 77 |
ifeq (,$(PERL_PATH)) |
| 78 |
PERL_PATH = perl |
| 79 |
endif # ! PERL_PATH |
| 80 |
|
| 81 |
ifeq ($(VXWORKS_VERSION_FLAG),) |
| 82 |
VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x620 |
| 83 |
endif # VXWORKS_VERSION_FLAG |
| 84 |
|
| 85 |
ifeq ($(TOOL),) |
| 86 |
override TOOL = gnu |
| 87 |
else |
| 88 |
override TOOL := $(TOOL) |
| 89 |
endif |
| 90 |
ifeq ($(TOOL_FAMILY),) |
| 91 |
ifeq ($(findstring gnu,$(TOOL)),gnu) |
| 92 |
override TOOL_FAMILY := gnu |
| 93 |
else |
| 94 |
override TOOL_FAMILY := diab |
| 95 |
endif |
| 96 |
endif |
| 97 |
|
| 98 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 99 |
templates ?= automatic |
| 100 |
endif |
| 101 |
|
| 102 |
ifeq ($(rtp),0) |
| 103 |
ifeq ($(findstring PPC, $(CPU)), PPC) |
| 104 |
CPPFLAGS += -mlongcall |
| 105 |
endif |
| 106 |
PRJ_TYPE = vxApp |
| 107 |
endif |
| 108 |
|
| 109 |
ifeq ($(rtp),1) |
| 110 |
TARGET_DIR = $(WIND_BASE)/target/usr |
| 111 |
else |
| 112 |
TARGET_DIR = $(WIND_BASE)/target/h |
| 113 |
endif |
| 114 |
TGT_DIR = $(WIND_BASE)/target |
| 115 |
|
| 116 |
ifeq ($(CPU),) |
| 117 |
# default CPU |
| 118 |
CPU = SIMNT |
| 119 |
else |
| 120 |
override CPU := $(CPU) |
| 121 |
endif |
| 122 |
|
| 123 |
ifeq ($(shared_libs),1) |
| 124 |
SHARED_LIBS = 1 |
| 125 |
endif |
| 126 |
ifeq ($(shared_libs_only),1) |
| 127 |
SHARED_LIBS = 1 |
| 128 |
endif |
| 129 |
|
| 130 |
ifeq ($(rtp),0) |
| 131 |
ifeq ($(SHARED_LIBS),1) |
| 132 |
ACELIB = -L./ |
| 133 |
#### There's no difference between non-shared and shared object code. |
| 134 |
VSHDIR = $(VDIR) |
| 135 |
endif # shared_libs |
| 136 |
endif |
| 137 |
|
| 138 |
BIN_UNCHECKED ?= |
| 139 |
SHLIB_UNCHECKED ?= |
| 140 |
|
| 141 |
ifneq ("$(BIN_UNCHECKED)","") |
| 142 |
VX_APP_BUILD := 1 |
| 143 |
else |
| 144 |
ifeq ($(SHARED_LIBS),1) |
| 145 |
ifneq ("$(SHLIB_UNCHECKED)","") |
| 146 |
VX_SO_BUILD := 1 |
| 147 |
endif |
| 148 |
endif |
| 149 |
ifneq ($(VX_SO_BUILD),1) |
| 150 |
VX_LIB_BUILD := 1 |
| 151 |
endif |
| 152 |
endif |
| 153 |
|
| 154 |
ifneq ($(VX_LIB_BUILD),1) |
| 155 |
ifeq ($(rtp),0) |
| 156 |
VXWORKSLINK = 1 |
| 157 |
endif |
| 158 |
ifeq ($(VX_APP_BUILD),1) |
| 159 |
## set variables for VxWorks linktarget identification |
| 160 |
ifeq ($(rtp),0) |
| 161 |
EXEEXT = .out |
| 162 |
PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxworks |
| 163 |
else |
| 164 |
PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxe |
| 165 |
EXEEXT = .vxe |
| 166 |
VXE_DIR := $(OUTPUT_DIRECTORY) |
| 167 |
EXE = $(BIN_UNCHECKED) |
| 168 |
endif |
| 169 |
PRJ_DIR = . |
| 170 |
CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) $(CLEANUP_OBJS) |
| 171 |
else |
| 172 |
## set variables for VxWorks .SO linktarget identification |
| 173 |
PRJ_FILE = $(basename $(notdir $(SHLIB_UNCHECKED))).vxworks |
| 174 |
PRJ_DIR = . |
| 175 |
CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) *.out $(CLEANUP_OBJS) |
| 176 |
endif |
| 177 |
endif |
| 178 |
|
| 179 |
ifeq ($(rtp),1) |
| 180 |
include $(WIND_USR)/make/defs.default |
| 181 |
include $(WIND_USR)/make/defs.$(WIND_HOST_TYPE) |
| 182 |
include $(WIND_USR)/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) |
| 183 |
CPPFLAGS += -mrtp |
| 184 |
LDFLAGS := $(filter-out -X, $(LDFLAGS)) |
| 185 |
LDFLAGS := $(filter-out -N, $(LDFLAGS)) |
| 186 |
LD := $(CPLUS) |
| 187 |
DLD := $(CPLUS) |
| 188 |
|
| 189 |
ifeq ($(SHARED_LIBS), 1)) |
| 190 |
ifeq ($(PRJ_TYPE),library) |
| 191 |
PICDIR = /PIC |
| 192 |
endif |
| 193 |
endif |
| 194 |
|
| 195 |
ifeq ($(findstring *sf,*$(TOOL)),*sf) |
| 196 |
LDFLAGS += -L$(WIND_USR)/lib/$(VX_CPU_FAMILY)/$(CPU)/sfcommon$(PICDIR) |
| 197 |
else |
| 198 |
LDFLAGS += -L$(WIND_USR)/lib/$(VX_CPU_FAMILY)/$(CPU)/common$(PICDIR) |
| 199 |
endif |
| 200 |
|
| 201 |
LDLIBS += -ldl |
| 202 |
else |
| 203 |
include $(TGT_DIR)/h/make/defs.default |
| 204 |
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) |
| 205 |
include $(TGT_DIR)/h/make/defs.$(PRJ_TYPE) |
| 206 |
include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) |
| 207 |
endif |
| 208 |
|
| 209 |
no_cflags_ansi ?= 0 |
| 210 |
ifeq ($(no_cflags_ansi), 1) |
| 211 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 212 |
CC_COMPILER := $(filter-out -ansi, $(CC_COMPILER)) |
| 213 |
else |
| 214 |
CC_COMPILER := $(filter-out -Xansi, $(CC_COMPILER)) |
| 215 |
endif |
| 216 |
endif |
| 217 |
|
| 218 |
no_ccflags_ansi ?= 0 |
| 219 |
ifeq ($(no_ccflags_ansi), 1) |
| 220 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 221 |
C++_COMPILER := $(filter-out -ansi, $(C++_COMPILER)) |
| 222 |
else |
| 223 |
C++_COMPILER := $(filter-out -Xansi, $(C++_COMPILER)) |
| 224 |
endif |
| 225 |
endif |
| 226 |
|
| 227 |
ifeq ($(VXWORKSLINK),1) |
| 228 |
# prevent possible clash with static LIB rules |
| 229 |
# in VxWorks make includes and rules.lib.GNU |
| 230 |
override ARCHIVE = |
| 231 |
override LARGE_PROJECT = |
| 232 |
PRJ_OBJS = $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 233 |
ifeq ($(SHARED_LIBS),1) |
| 234 |
##LD_PARTIAL += -L$(ACE_ROOT)/lib -L./ $(LDLIBPATH) $(LD_LINK_PATH) |
| 235 |
PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 236 |
ifeq ($(VX_SO_BUILD),1) |
| 237 |
## Shared lib builds for VxWorks will also build 'import' libraries |
| 238 |
LIB_INSTALL += $(VLIB:%=$(INSLIB)/%) |
| 239 |
CLEANUP_INSTALL += $(CLEANUP_VLIB:%=$(INSLIB)/%) |
| 240 |
REALCLEAN_FILES += $(CLEANUP_LIB:%=%) $(CLEANUP_LIB:%=%_debug) $(CLEANUP_LIB:%=%_profile) $(CLEANUP_LIB:%=%_optimize) |
| 241 |
endif |
| 242 |
else |
| 243 |
LD_PARTIAL += -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH) $(LD_PARTIALFLAGS) |
| 244 |
PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) $(VLDLIBS) $(ACE_SHLIBS) $(LIBS) |
| 245 |
endif |
| 246 |
PRJ_OBJS_FOR_LD=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 247 |
PRJ_OBJS_FOR_NM=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 248 |
PRJ_OBJS_FOR_AR=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 249 |
POST_BUILD_RULE = $(POSTLINK) |
| 250 |
COMPILE_TRADITIONAL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS)\ |
| 251 |
$(filter-out -ansi, $(CFLAGS)) |
| 252 |
|
| 253 |
## make sure default target stays the ACE/TAO default target |
| 254 |
## |
| 255 |
default: all |
| 256 |
|
| 257 |
endif |
| 258 |
|
| 259 |
CPPFLAGS += $(VXWORKS_VERSION_FLAG) |
| 260 |
|
| 261 |
ifeq ($(debug),1) |
| 262 |
DCFLAGS += -g |
| 263 |
DCCFLAGS += -g |
| 264 |
CPPFLAGS += |
| 265 |
endif |
| 266 |
|
| 267 |
ifeq ($(pthread),1) |
| 268 |
CPPFLAGS += -DACE_HAS_PTHREADS |
| 269 |
endif |
| 270 |
|
| 271 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 272 |
# Test for template instantiation, add to SOFLAGS if SONAME set, |
| 273 |
# add -E to LDFLAGS if using GNU ld |
| 274 |
include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU |
| 275 |
|
| 276 |
ifeq ("$(templates)","automatic") |
| 277 |
ifeq ($(repo),1) |
| 278 |
ifeq ($(VXWORKSLINK),1) |
| 279 |
ifeq ($(VX_APP_BUILD),1) |
| 280 |
ifneq ($(SHARED_LIBS),1) |
| 281 |
LD_PARTIAL += -frepo |
| 282 |
endif |
| 283 |
endif |
| 284 |
else |
| 285 |
ifeq ($(rtp),0) |
| 286 |
ace_lib_prelink := 1 |
| 287 |
LINK.cc = override |
| 288 |
LINK.cc.override = $(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L$(INSLIB) -L./ $(LDLIBPATH) $(LD_LINK_PATH) |
| 289 |
ifneq ($(SHARED_LIBS),1) |
| 290 |
LDFLAGS = $(ACE_SHLIBS) |
| 291 |
endif |
| 292 |
endif |
| 293 |
endif |
| 294 |
endif |
| 295 |
endif |
| 296 |
endif # TOOL_FAMILY == gnu |
| 297 |
|
| 298 |
ifeq ("$(TOOL_FAMILY)","diab") |
| 299 |
C++FLAGS += -Xexceptions |
| 300 |
else |
| 301 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 302 |
C++FLAGS += -fexceptions |
| 303 |
endif |
| 304 |
endif |
| 305 |
|
| 306 |
ifneq ($(findstring $(VX_CPU_FAMILY),ppc arm),) |
| 307 |
ifeq ("$(TOOL_FAMILY)","diab") |
| 308 |
C++FLAGS += -Xchar-signed |
| 309 |
else |
| 310 |
ifeq ("$(TOOL_FAMILY)","gnu") |
| 311 |
C++FLAGS += -fsigned-char |
| 312 |
endif |
| 313 |
endif |
| 314 |
endif |
| 315 |
|
| 316 |
ifeq ($(CPU),SIMNT) |
| 317 |
override MUNCH_FLAGS := -asm $(TOOLENV) |
| 318 |
endif |
| 319 |
|
| 320 |
ifneq ($(optimize),1) |
| 321 |
CC_OPTIM_NORMAL = |
| 322 |
endif |
| 323 |
|
| 324 |
CCFLAGS += $(C++FLAGS) $(FLAGS_C_CC) |
| 325 |
|
| 326 |
ifeq (0,$(rtp)) |
| 327 |
PIC = |
| 328 |
else |
| 329 |
ifeq ("$(TOOL)","diab") |
| 330 |
PIC = -Xpic |
| 331 |
else |
| 332 |
ifeq ("$(TOOL)","gnu") |
| 333 |
PIC = -fpic |
| 334 |
endif |
| 335 |
endif |
| 336 |
endif |
| 337 |
|
| 338 |
ifeq ($(VXWORKSLINK),1) |
| 339 |
|
| 340 |
ifeq ($(repo),1) |
| 341 |
ifeq ($(SHARED_LIBS),1) |
| 342 |
BACKUP_RPO_RULE = for %f in ($(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS))) do if exist %f.rpo mv %f.rpo %f.rpobak $(ACE_NUL_STDERR) |
| 343 |
POST_BUILD_RULE = for %f in ($(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS))) do if exist %f.rpobak mv %f.rpobak %f.rpo $(ACE_NUL_STDERR) |
| 344 |
endif |
| 345 |
endif |
| 346 |
|
| 347 |
.PHONY: $(PRJ_DIR)/$(PRJ_FILE) |
| 348 |
## special target to satisfy VxWorks dependencies for images |
| 349 |
$(PRJ_DIR)/$(PRJ_FILE): |
| 350 |
ifeq ($(repo),1) |
| 351 |
ifeq ($(SHARED_LIBS),1) |
| 352 |
#### execute prelink step to make compiler instantiate all needed |
| 353 |
#### templates; discard image and repo files (*.rpo) after linkstep |
| 354 |
#### this step holds for both .SO as well as 'app' images so use both VSHOBJS and OBJS |
| 355 |
-$(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH)$(LINK_OUTPUT_FLAG) ace-templ_inst $? $(ACE_SHLIBS) $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) |
| 356 |
-$(RM) ace-templ_inst |
| 357 |
#### We need to backup the .RPO files or otherwise the link step of the final image will |
| 358 |
#### start instantiating templates again even if we do not specify '-frepo'! |
| 359 |
-$(BACKUP_RPO_RULE) |
| 360 |
ifeq ($(VX_SO_BUILD),1) |
| 361 |
#### build library of objects in .SO to use as a sort of import library for VxWorks |
| 362 |
echo $(filter %.o, $(VSHOBJS)) | xargs $(AR) $(ARFLAGS) $(VLIB) $(AREXTRA) |
| 363 |
-chmod a+r $(VLIB) |
| 364 |
ifneq (,$(RANLIB)) |
| 365 |
-$(RANLIB) $(VLIB) |
| 366 |
endif # RANLIB |
| 367 |
endif # VX_SO_BUILD |
| 368 |
endif |
| 369 |
endif |
| 370 |
@echo 1>$@ |
| 371 |
|
| 372 |
endif |