1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at https://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 ###########################################################################
22 #*****************************************************************************
25 #Filename : Makefile.vxworks
26 #Description: makefile to be used in order to compile libcurl for VxWoorks 6.3.
29 # 1. Adjust environment variables at the file beginning
30 # 2. Open the Command Prompt window and change directory ('cd')
31 # into the 'lib' folder
32 # 3. Add <CYGWIN>/bin folder to the PATH environment variable
33 # For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%'
34 # 4. Build the library by typing 'make -f ./Makefile.vxworks'
35 # As a result the libcurl.a should be created in the 'lib' folder.
36 # To clean package use 'make -f ./Makefile.vxworks clean'
39 # 2. Full CYGWIN installation (open source) with GNU make version
41 # 3. WindRiver Workbench with vxWorks 6.3 (commercial)
42 #*****************************************************************************
44 # ----------------------------------------------------------------------
46 # ----------------------------------------------------------------------
48 export WIND_HOME := C:/embedded/Workbench2.5.0.1
49 export WIND_BASE := $(WIND_HOME)/vxworks-6.3
50 export WIND_HOST_TYPE := x86-win32
52 # BUILD_TYE:= <debug>|<release> (build with debugging info or optimized)
56 # directories where to seek for includes and libraries
57 OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3/include
58 OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3
59 ZLIB_INC := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/zlib-1.2.8
60 ZLIB_LIB := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib
65 # ----------------------------------------------------------------------
67 # ----------------------------------------------------------------------
72 CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS)
73 LDFLAGS := -nostdlib -Wl,-i -Wl,-X
77 COMPILE_ONLY_FLAG := -c
83 LD_DEBUGFLAG := $(C_DEBUGFLAG)
84 EXECUTE_EXTENSION := .out
85 TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/
87 # ----------------------------------------------------------------------
89 # Add -DINET6 if the OS kernel image was built with IPv6 support
92 # Set up compiler and linker flags for debug or optimization
93 ifeq ($(BUILD_TYPE), debug)
94 CFLAGS += $(C_DEBUGFLAG)
95 LDFLAGS += $(LD_DEBUGFLAG)
97 CFLAGS += $(C_OPTFLAG)
100 # ----------------------------------------------------------------------
102 # Main Makefile and possible sub-make files
103 MAKEFILES := Makefile.vxworks
105 # List of external include directories
107 # IMPORTANT: include OPENSSL directories before system
108 # in order to prevent WindRiver OpenSSL to be used.
110 INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip
112 # List of external libraries and their directories
115 ifneq ($(OPENSSL_LIB), )
116 LIBS_LIST += crypto ssl
117 LIB_DIRS += $(OPENSSL_LIB)
119 ifneq ($(ZLIB_LIB), )
121 LIB_DIRS += $(ZLIB_LIB)
123 ifneq ($(ARES_LIB), )
125 LIB_DIRS += $(ARES_LIB)
128 # Add include and library directories and libraries
129 CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%)
130 LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%)
132 # List of targets to make for libs target
133 LIBS_TARGET_LIST := libcurl.a
135 # List of execuatble applications to make in addition to libs for all target
138 # Support for echoing rules
139 # If ECHORULES variable was set (for example, using 'make' command line)
140 # some shell commands in the rules will be echoed
141 ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),)
147 # Directory to hold compilation intermediate files
150 # Get sources and headers to be compiled
154 INCLUDE_FILES := $(HHEADERS)
155 INCLUDE_FILES += $(shell find ../include -name \*.h)
158 OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION))
161 # ----------------------------------------------------------------------
164 # It should be first rule in this file
168 #### Compiling C files
169 $(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES)
170 @echo Compiling C file $< $(ECHO_STDOUT)
171 @[ -d $(@D) ] || mkdir -p $(@D)
172 $(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT)
174 #### Creating library
175 $(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST)
176 @echo Creating library $@ $(ECHO_STDOUT)
177 $(_@_) [ -d $(@D) ] || mkdir -p $(@D)
179 $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^)
181 #### Creating application
182 $(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST)
183 @echo Creating application $@
184 @[ -d $(@D) ] || mkdir -p $(@D)
185 $(_@_) $(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)
188 libs: $(LIBS_TARGET_LIST)
191 all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST)
192 @echo All targets made.
197 $(_@_) rm -rf $(TMP_DIR)
198 @echo libcurl was cleaned.