Makefile.vxworks 5.6 KB

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