Makefile.vxworks 6.6 KB

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