Makefile.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. --- Makefile.orig 2010-08-21 20:52:22.923386908 +0000
  2. +++ Makefile 2010-08-21 14:29:13.000000000 +0000
  3. @@ -1,130 +1,33 @@
  4. -#****************************************************************************
  5. -#
  6. -# Makefile for TinyXml test.
  7. -# Lee Thomason
  8. -# www.grinninglizard.com
  9. -#
  10. -# This is a GNU make (gmake) makefile
  11. -#****************************************************************************
  12. -
  13. -# DEBUG can be set to YES to include debugging info, or NO otherwise
  14. -DEBUG := NO
  15. -
  16. -# PROFILE can be set to YES to include profiling info, or NO otherwise
  17. -PROFILE := NO
  18. -
  19. -# TINYXML_USE_STL can be used to turn on STL support. NO, then STL
  20. -# will not be used. YES will include the STL files.
  21. -TINYXML_USE_STL := NO
  22. -
  23. -#****************************************************************************
  24. -
  25. -CC := gcc
  26. -CXX := g++
  27. -LD := g++
  28. -AR := ar rc
  29. -RANLIB := ranlib
  30. -
  31. -DEBUG_CFLAGS := -Wall -Wno-format -g -DDEBUG
  32. -RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3
  33. -
  34. -LIBS :=
  35. -
  36. -DEBUG_CXXFLAGS := ${DEBUG_CFLAGS}
  37. -RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}
  38. -
  39. -DEBUG_LDFLAGS := -g
  40. -RELEASE_LDFLAGS :=
  41. -
  42. -ifeq (YES, ${DEBUG})
  43. - CFLAGS := ${DEBUG_CFLAGS}
  44. - CXXFLAGS := ${DEBUG_CXXFLAGS}
  45. - LDFLAGS := ${DEBUG_LDFLAGS}
  46. -else
  47. - CFLAGS := ${RELEASE_CFLAGS}
  48. - CXXFLAGS := ${RELEASE_CXXFLAGS}
  49. - LDFLAGS := ${RELEASE_LDFLAGS}
  50. -endif
  51. -
  52. -ifeq (YES, ${PROFILE})
  53. - CFLAGS := ${CFLAGS} -pg -O3
  54. - CXXFLAGS := ${CXXFLAGS} -pg -O3
  55. - LDFLAGS := ${LDFLAGS} -pg
  56. -endif
  57. -
  58. -#****************************************************************************
  59. -# Preprocessor directives
  60. -#****************************************************************************
  61. -
  62. -ifeq (YES, ${TINYXML_USE_STL})
  63. - DEFS := -DTIXML_USE_STL
  64. -else
  65. - DEFS :=
  66. -endif
  67. -
  68. -#****************************************************************************
  69. -# Include paths
  70. -#****************************************************************************
  71. -
  72. -#INCS := -I/usr/include/g++-2 -I/usr/local/include
  73. -INCS :=
  74. -
  75. -
  76. -#****************************************************************************
  77. -# Makefile code common to all platforms
  78. -#****************************************************************************
  79. -
  80. -CFLAGS := ${CFLAGS} ${DEFS}
  81. -CXXFLAGS := ${CXXFLAGS} ${DEFS}
  82. -
  83. -#****************************************************************************
  84. -# Targets of the build
  85. -#****************************************************************************
  86. -
  87. -OUTPUT := xmltest
  88. -
  89. -all: ${OUTPUT}
  90. -
  91. -
  92. -#****************************************************************************
  93. -# Source files
  94. -#****************************************************************************
  95. -
  96. -SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp tinystr.cpp
  97. -
  98. -# Add on the sources for libraries
  99. -SRCS := ${SRCS}
  100. -
  101. -OBJS := $(addsuffix .o,$(basename ${SRCS}))
  102. -
  103. -#****************************************************************************
  104. -# Output
  105. -#****************************************************************************
  106. -
  107. -${OUTPUT}: ${OBJS}
  108. - ${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS}
  109. -
  110. -#****************************************************************************
  111. -# common rules
  112. -#****************************************************************************
  113. -
  114. -# Rules for compiling source files to object files
  115. -%.o : %.cpp
  116. - ${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@
  117. -
  118. -%.o : %.c
  119. - ${CC} -c ${CFLAGS} ${INCS} $< -o $@
  120. -
  121. -dist:
  122. - bash makedistlinux
  123. +AR ?= ar
  124. +CXX ?= g++
  125. +CXXFLAGS += -Wall
  126. +RANLIB ?= ranlib
  127. +
  128. +name = libtinyxml
  129. +major = @MAJOR_V@
  130. +minor = @MINOR_V@
  131. +version = $(major).$(minor)
  132. +
  133. +src = tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp tinystr.cpp
  134. +lo = $(addsuffix .lo,$(basename ${src}))
  135. +o = $(addsuffix .o,$(basename ${src}))
  136. +
  137. +all: $(name).a $(name).so
  138. +
  139. +%.o: %.cpp
  140. + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
  141. +
  142. +$(name).a: $(o)
  143. + $(AR) rc $(name).a $(o)
  144. + $(RANLIB) $(name).a
  145. +
  146. +%.lo: %.cpp
  147. + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -fPIC $< -o $@
  148. +
  149. +$(name).so: $(lo)
  150. + $(CXX) $(LDFLAGS) -fPIC -shared $(lo) -Wl,-soname,$(name).so.$(major) -o $(name).so.$(version)
  151. + ln -s $(name).so.$(version) $(name).so.$(major)
  152. + ln -s $(name).so.$(version) $(name).so
  153. clean:
  154. - -rm -f core ${OBJS} ${OUTPUT}
  155. -
  156. -depend:
  157. - #makedepend ${INCS} ${SRCS}
  158. -
  159. -tinyxml.o: tinyxml.h tinystr.h
  160. -tinyxmlparser.o: tinyxml.h tinystr.h
  161. -xmltest.o: tinyxml.h tinystr.h
  162. -tinyxmlerror.o: tinyxml.h tinystr.h
  163. + -rm -f *.o *.lo *.so* *.a