Makefile.vxworks 5.6 KB

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