1
0

001-crosscompile.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. --- a/Makefile
  2. +++ b/Makefile
  3. @@ -15,87 +15,82 @@
  4. prefix = /usr/local
  5. exec_prefix = ${prefix}
  6. bindir = ${exec_prefix}/bin
  7. +libdir = ${prefix}/lib
  8. #########################################
  9. CC = gcc
  10. -OBJ = open2300.o rw2300.o linux2300.o win2300.o
  11. -LOGOBJ = log2300.o rw2300.o linux2300.o win2300.o
  12. -FETCHOBJ = fetch2300.o rw2300.o linux2300.o win2300.o
  13. -WUOBJ = wu2300.o rw2300.o linux2300.o win2300.o
  14. -CWOBJ = cw2300.o rw2300.o linux2300.o win2300.o
  15. -DUMPOBJ = dump2300.o rw2300.o linux2300.o win2300.o
  16. -HISTOBJ = history2300.o rw2300.o linux2300.o win2300.o
  17. -HISTLOGOBJ = histlog2300.o rw2300.o linux2300.o win2300.o
  18. -DUMPBINOBJ = bin2300.o rw2300.o linux2300.o win2300.o
  19. -XMLOBJ = xml2300.o rw2300.o linux2300.o win2300.o
  20. -PGSQLOBJ = pgsql2300.o rw2300.o linux2300.o win2300.o
  21. -LIGHTOBJ = light2300.o rw2300.o linux2300.o win2300.o
  22. -INTERVALOBJ = interval2300.o rw2300.o linux2300.o win2300.o
  23. -MINMAXOBJ = minmax2300.o rw2300.o linux2300.o win2300.o
  24. -MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
  25. +LIB = lib2300
  26. +LIB_C = rw2300.c linux2300.c
  27. +LIBOBJ = rw2300.o linux2300.o
  28. VERSION = 1.11
  29. CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
  30. -CC_LDFLAGS = -lm
  31. -CC_WINFLAG =
  32. -# For Windows - comment the two line above and un-comment the two lines below.
  33. -#CC_LDFLAGS = -lm -lwsock32
  34. -#CC_WINFLAG = -mwindows
  35. +CC_LDFLAGS = -L. -lm -l2300
  36. +LFLAGS = -shared -Wl,-soname
  37. INSTALL = install
  38. +MAKE_EXEC = $(CC) $(CFLAGS) $@.c -o $@ $(CC_LDFLAGS)
  39. ####### Build rules
  40. -all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300
  41. +all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 #mysql2300 mysqlhistlog2300
  42. -open2300 : $(OBJ)
  43. - $(CC) $(CFLAGS) -o $@ $(OBJ) $(CC_LDFLAGS)
  44. -
  45. -dump2300 : $(DUMPOBJ)
  46. - $(CC) $(CFLAGS) -o $@ $(DUMPOBJ) $(CC_LDFLAGS)
  47. +lib2300 :
  48. + $(CC) -c -fPIC $(CFLAGS) $(LIB_C)
  49. + $(CC) $(LFLAGS),$@.so -o $@.so.$(VERSION) $(LIBOBJ)
  50. + ln -sf $@.so.$(VERSION) $@.so
  51. +
  52. +open2300 : $(LIB)
  53. + $(MAKE_EXEC)
  54. -log2300 : $(LOGOBJ)
  55. - $(CC) $(CFLAGS) -o $@ $(LOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  56. +dump2300 : $(LIB)
  57. + $(MAKE_EXEC)
  58. -fetch2300 : $(FETCHOBJ)
  59. - $(CC) $(CFLAGS) -o $@ $(FETCHOBJ) $(CC_LDFLAGS)
  60. +log2300 : $(LIB)
  61. + $(MAKE_EXEC)
  62. -wu2300 : $(WUOBJ)
  63. - $(CC) $(CFLAGS) -o $@ $(WUOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  64. +fetch2300 : $(LIB)
  65. + $(MAKE_EXEC)
  66. +
  67. +srv2300 : $(LIB)
  68. + $(MAKE_EXEC)
  69. +
  70. +wu2300 : $(LIB)
  71. + $(MAKE_EXEC)
  72. -cw2300 : $(CWOBJ)
  73. - $(CC) $(CFLAGS) -o $@ $(CWOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  74. +cw2300 : $(LIB)
  75. + $(MAKE_EXEC)
  76. -history2300 : $(HISTOBJ)
  77. - $(CC) $(CFLAGS) -o $@ $(HISTOBJ) $(CC_LDFLAGS)
  78. +history2300 : $(LIB)
  79. + $(MAKE_EXEC)
  80. -histlog2300 : $(HISTLOGOBJ)
  81. - $(CC) $(CFLAGS) -o $@ $(HISTLOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  82. +histlog2300 : $(LIB)
  83. + $(MAKE_EXEC)
  84. -bin2300 : $(DUMPBINOBJ)
  85. - $(CC) $(CFLAGS) -o $@ $(DUMPBINOBJ) $(CC_LDFLAGS)
  86. +bin2300 : $(LIB)
  87. + $(MAKE_EXEC)
  88. -xml2300 : $(XMLOBJ)
  89. - $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  90. +xml2300 : $(LIB)
  91. + $(MAKE_EXEC)
  92. -mysql2300:
  93. - $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
  94. +mysql2300: $(LIB)
  95. + $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
  96. -pgsql2300: $(PGSQLOBJ)
  97. - $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
  98. +pgsql2300: $(LIB)
  99. + $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/pgsql -L/usr/lib/pgsql $(CC_LDFLAGS) -lpq
  100. -light2300: $(LIGHTOBJ)
  101. - $(CC) $(CFLAGS) -o $@ $(LIGHTOBJ) $(CC_LDFLAGS)
  102. +light2300: $(LIB)
  103. + $(MAKE_EXEC)
  104. -interval2300: $(INTERVALOBJ)
  105. - $(CC) $(CFLAGS) -o $@ $(INTERVALOBJ) $(CC_LDFLAGS)
  106. +interval2300: $(LIB)
  107. + $(MAKE_EXEC)
  108. -minmax2300: $(MINMAXOBJ)
  109. - $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
  110. +minmax2300: $(LIB)
  111. + $(MAKE_EXEC)
  112. -mysqlhistlog2300 :
  113. - $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
  114. +mysqlhistlog2300 : $(LIB)
  115. + $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
  116. install: