1 #*****************************************************************************
4 #Filename : Makefile.vxworks
5 #Description: makefile to be used in order to compile libcurl for VxWoorks 6.3.
8 # 1. Adjust environment variables at the file begining
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'
18 # 2. Full CYGWIN installation (open source) with GNU make version
20 # 3. WindRiver Workbench with vxWorks 6.3 (commercial)
21 #*****************************************************************************
23 # ----------------------------------------------------------------------
25 # ----------------------------------------------------------------------
27 export WIND_HOME := C:/embedded/Workbench2.5.0.1
28 export WIND_BASE := $(WIND_HOME)/vxworks-6.3
29 export WIND_HOST_TYPE := x86-win32
31 # BUILD_TYE:= <debug>|<release> (build with debugging info or optimized)
35 # directories where to seek for includes and libraries
36 OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3/include
37 OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3
38 ZLIB_INC := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/zlib-1.2.3
39 ZLIB_LIB := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib
44 # ----------------------------------------------------------------------
46 # ----------------------------------------------------------------------
51 CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS)
52 LDFLAGS := -nostdlib -Wl,-i -Wl,-X
56 COMPILE_ONLY_FLAG := -c
62 LD_DEBUGFLAG := $(C_DEBUGFLAG)
63 EXECUTE_EXTENSION := .out
64 TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/
66 # ----------------------------------------------------------------------
68 # Add -DINET6 if the OS kernel image was built with IPv6 support
71 # Set up compiler and linker flags for debug or optimization
72 ifeq ($(BUILD_TYPE), debug)
73 CFLAGS += $(C_DEBUGFLAG)
74 LDFLAGS += $(LD_DEBUGFLAG)
76 CFLAGS += $(C_OPTFLAG)
79 # ----------------------------------------------------------------------
81 # Main Makefile and possible sub-make files
82 MAKEFILES := Makefile.vxworks
84 # List of external include directories
86 # IMPORTANT: include OPENSSL directories before system
87 # in order to prevent WindRiver OpenSSL to be used.
89 INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip
91 # List of external libraries and their directories
94 ifneq ($(OPENSSL_LIB), )
95 LIBS_LIST += crypto ssl
96 LIB_DIRS += $(OPENSSL_LIB)
100 LIB_DIRS += $(ZLIB_LIB)
102 ifneq ($(ARES_LIB), )
104 LIB_DIRS += $(ARES_LIB)
107 # Add include and library directories and libraries
108 CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%)
109 LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%)
111 # List of targets to make for libs target
112 LIBS_TARGET_LIST := libcurl.a
114 # List of execuatble applications to make in addition to libs for all target
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
120 ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),)
126 # Directory to hold compilation intermediate files
129 # Get sources and headers to be compiled
133 INCLUDE_FILES := $(HHEADERS)
134 INCLUDE_FILES += $(shell find ../include -name \*.h)
137 OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION))
140 # ----------------------------------------------------------------------
143 # It should be first rule in this file
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)
153 #### Creating library
154 $(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST)
155 @echo Creating library $@ $(ECHO_STDOUT)
156 $(_@_) [ -d $(@D) ] || mkdir -p $(@D)
158 $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^)
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)
167 libs: $(LIBS_TARGET_LIST)
170 all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST)
171 @echo All targets made.
176 $(_@_) rm -rf $(TMP_DIR)
177 @echo libcurl was cleaned.