1#***************************************************************************** 2# 3# 4#Filename : Makefile.vxworks 5#Description: makefile to be used in order to compile libcurl for VxWoorks 6.3. 6# 7#How to use: 8# 1. Adjust environment variables at the file beginning 9# 2. Open the Command Prompt window and change directory ('cd') 10# into the 'lib' folder 11# 3. Add <CYGWIN>/bin folder to the PATH environment variable 12# For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%' 13# 4. Build the library by typing 'make -f ./Makefile.vxworks' 14# As a result the libcurl.a should be created in the 'lib' folder. 15# To clean package use 'make -f ./Makefile.vxworks clean' 16#Requirements: 17# 1. WinXP machine 18# 2. Full CYGWIN installation (open source) with GNU make version 19# v3.78 or higher 20# 3. WindRiver Workbench with vxWorks 6.3 (commercial) 21#***************************************************************************** 22 23# ---------------------------------------------------------------------- 24# Environment 25# ---------------------------------------------------------------------- 26 27export WIND_HOME := C:/embedded/Workbench2.5.0.1 28export WIND_BASE := $(WIND_HOME)/vxworks-6.3 29export WIND_HOST_TYPE := x86-win32 30 31# BUILD_TYE:= <debug>|<release> (build with debugging info or optimized) 32BUILD_TYPE := debug 33USER_CFLAGS:= 34 35# directories where to seek for includes and libraries 36OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3/include 37OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3 38ZLIB_INC := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/zlib-1.2.8 39ZLIB_LIB := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib 40ARES_INC := 41ARES_LIB := 42 43 44# ---------------------------------------------------------------------- 45# Compiler 46# ---------------------------------------------------------------------- 47 48CC := ccppc 49AR := arppc 50LINK := ccppc 51CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS) 52LDFLAGS := -nostdlib -Wl,-i -Wl,-X 53INCLUDE_FLAG := -I 54C_DEBUGFLAG := -g 55C_OPTFLAG := -O2 56COMPILE_ONLY_FLAG := -c 57OBJ_EXTENSION := .o 58CC_OBJ_OUTPUT = -o $@ 59ARFLAGS := -rc 60LIBS_FLAG := -l 61LIBS_DIRFLAG:= -L 62LD_DEBUGFLAG := $(C_DEBUGFLAG) 63EXECUTE_EXTENSION := .out 64TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/ 65 66# ---------------------------------------------------------------------- 67 68# Add -DINET6 if the OS kernel image was built with IPv6 support 69# CFLAGS += -DINET6 70 71# Set up compiler and linker flags for debug or optimization 72ifeq ($(BUILD_TYPE), debug) 73CFLAGS += $(C_DEBUGFLAG) 74LDFLAGS += $(LD_DEBUGFLAG) 75else 76CFLAGS += $(C_OPTFLAG) 77endif 78 79# ---------------------------------------------------------------------- 80 81# Main Makefile and possible sub-make files 82MAKEFILES := Makefile.vxworks 83 84# List of external include directories 85#----- 86# IMPORTANT: include OPENSSL directories before system 87# in order to prevent WindRiver OpenSSL to be used. 88#----- 89INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip 90 91# List of external libraries and their directories 92LIBS_LIST := . 93LIB_DIRS := . 94ifneq ($(OPENSSL_LIB), ) 95LIBS_LIST += crypto ssl 96LIB_DIRS += $(OPENSSL_LIB) 97endif 98ifneq ($(ZLIB_LIB), ) 99LIBS_LIST += z 100LIB_DIRS += $(ZLIB_LIB) 101endif 102ifneq ($(ARES_LIB), ) 103LIBS_LIST += ares 104LIB_DIRS += $(ARES_LIB) 105endif 106 107# Add include and library directories and libraries 108CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%) 109LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%) 110 111# List of targets to make for libs target 112LIBS_TARGET_LIST := libcurl.a 113 114# List of execuatble applications to make in addition to libs for all target 115EXE_TARGET_LIST := 116 117# Support for echoing rules 118# If ECHORULES variable was set (for example, using 'make' command line) 119# some shell commands in the rules will be echoed 120ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),) 121_@_ := 122else 123_@_ := @ 124endif 125 126# Directory to hold compilation intermediate files 127TMP_DIR := tmp 128 129# Get sources and headers to be compiled 130include Makefile.inc 131 132# List of headers 133INCLUDE_FILES := $(HHEADERS) 134INCLUDE_FILES += $(shell find ../include -name \*.h) 135 136# List of sources 137OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION)) 138 139 140# ---------------------------------------------------------------------- 141 142#### default rule 143# It should be first rule in this file 144.PHONY: default 145default: libcurl.a 146 147#### Compiling C files 148$(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES) 149 @echo Compiling C file $< $(ECHO_STDOUT) 150 @[ -d $(@D) ] || mkdir -p $(@D) 151 $(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT) 152 153#### Creating library 154$(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST) 155 @echo Creating library $@ $(ECHO_STDOUT) 156 $(_@_) [ -d $(@D) ] || mkdir -p $(@D) 157 $(_@_) rm -f $@ 158 $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^) 159 160#### Creating application 161$(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST) 162 @echo Creating application $@ 163 @[ -d $(@D) ] || mkdir -p $(@D) 164 $(_@_) $(TOOL_CHAIN_BIN)$(LINK) $(CC_OBJ_OUTPUT) $($(@)_EXE_OBJ_LIST) $(LDFLAGS) $($(@)_EXE_LIBS_NEEDED:%=$(LIBS_FLAG)%) $(LIBS_LIST:%=$(LIBS_FLAG)%) $(USER_LIBS_LIST) $(USER_LIBS_LIST) 165 166#### Master Targets 167libs: $(LIBS_TARGET_LIST) 168 @echo All libs made. 169 170all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST) 171 @echo All targets made. 172 173# Clean up 174.PHONY: clean 175clean: 176 $(_@_) rm -rf $(TMP_DIR) 177 @echo libcurl was cleaned. 178