1 #*****************************************************************************
5 #Filename : Makefile.vxworks
6 #Description: makefile to be used in order to compile libcurl for VxWoorks 6.3.
9 # 1. Adjust environment variables at the file begining
10 # 2. Open the Command Prompt window and change directory ('cd')
11 # into the 'lib' folder
12 # 3. Add <CYGWIN>/bin folder to the PATH environment variable
13 # For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%'
14 # 4. Build the library by typing 'make -f ./Makefile.vxworks'
15 # As a result the libcurl.a should be created in the 'lib' folder.
16 # To clean package use 'make -f ./Makefile.vxworks clean'
19 # 2. Full CYGWIN installation (open source) with GNU make version
21 # 3. WindRiver Workbench with vxWorks 6.3 (commercial)
22 #*****************************************************************************
24 # ----------------------------------------------------------------------
26 # ----------------------------------------------------------------------
28 export WIND_HOME := C:/embedded/Workbench2.5.0.1
29 export WIND_BASE := $(WIND_HOME)/vxworks-6.3
30 export WIND_HOST_TYPE := x86-win32
32 # BUILD_TYE:= <debug>|<release> (build with debugging info or optimized)
36 # directories where to seek for includes and libraries
37 OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3/include
38 OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3
39 ZLIB_INC := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/zlib-1.2.3
40 ZLIB_LIB := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib
45 # ----------------------------------------------------------------------
47 # ----------------------------------------------------------------------
52 CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS)
53 LDFLAGS := -nostdlib -Wl,-i -Wl,-X
57 COMPILE_ONLY_FLAG := -c
63 LD_DEBUGFLAG := $(C_DEBUGFLAG)
64 EXECUTE_EXTENSION := .out
65 TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/
67 # ----------------------------------------------------------------------
69 # Add -DINET6 if the OS kernel image was built with IPv6 support
72 # Set up compiler and linker flags for debug or optimization
73 ifeq ($(BUILD_TYPE), debug)
74 CFLAGS += $(C_DEBUGFLAG)
75 LDFLAGS += $(LD_DEBUGFLAG)
77 CFLAGS += $(C_OPTFLAG)
80 # ----------------------------------------------------------------------
82 # Main Makefile and possible sub-make files
83 MAKEFILES := Makefile.vxworks
85 # List of external include directories
87 # IMPORTANT: include OPENSSL directories before system
88 # in order to prevent WindRiver OpenSSL to be used.
90 INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip
92 # List of external libraries and their directories
95 ifneq ($(OPENSSL_LIB), )
96 LIBS_LIST += crypto ssl
97 LIB_DIRS += $(OPENSSL_LIB)
101 LIB_DIRS += $(ZLIB_LIB)
103 ifneq ($(ARES_LIB), )
105 LIB_DIRS += $(ARES_LIB)
108 # Add include and library directories and libraries
109 CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%)
110 LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%)
112 # List of targets to make for libs target
113 LIBS_TARGET_LIST := libcurl.a
115 # List of execuatble applications to make in addition to libs for all target
118 # Support for echoing rules
119 # If ECHORULES variable was set (for example, using 'make' command line)
120 # some shell commands in the rules will be echoed
121 ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),)
127 # Directory to hold compilation intermediate files
130 # Get sources and headers to be compiled
134 INCLUDE_FILES := $(HHEADERS)
135 INCLUDE_FILES += $(shell find ../include -name \*.h)
138 OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION))
141 # ----------------------------------------------------------------------
144 # It should be first rule in this file
148 #### Compiling C files
149 $(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES)
150 @echo Compiling C file $< $(ECHO_STDOUT)
151 @[ -d $(@D) ] || mkdir -p $(@D)
152 $(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT)
154 #### Creating library
155 $(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST)
156 @echo Creating library $@ $(ECHO_STDOUT)
157 $(_@_) [ -d $(@D) ] || mkdir -p $(@D)
159 $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^)
161 #### Creating application
162 $(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST)
163 @echo Creating application $@
164 @[ -d $(@D) ] || mkdir -p $(@D)
165 $(_@_) $(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)
168 libs: $(LIBS_TARGET_LIST)
171 all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST)
172 @echo All targets made.
177 $(_@_) rm -rf $(TMP_DIR)
178 @echo libcurl was cleaned.