x86_64_solaris_gcc.mk 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ##
  2. ## Solaris 11 x86_64 Makefile - ***USE GMAKE INSTEAD OF MAKE***
  3. ##
  4. ## Should work but it's ***UNTESTED*** please report feedback if You test it.
  5. ##
  6. TargetCPU :=x86_64
  7. OS :=solaris
  8. CXXFLAGS := -O3 -pedantic -MMD -MP -fPIC
  9. Platform :=$(TargetCPU)-$(OS)
  10. ConfigurationName :=Release
  11. IntermediateDirectory :=../temp/$(TargetCPU)
  12. OutDir := $(IntermediateDirectory)
  13. LinkerName :=g++ -m64
  14. SharedObjectLinkerName :=g++ -m64 -shared -fPIC
  15. DebugSwitch :=-gstab
  16. IncludeSwitch :=-I
  17. LibrarySwitch :=-l
  18. OutputSwitch :=-o
  19. LibraryPathSwitch :=-L
  20. PreprocessorSwitch :=-D
  21. SourceSwitch :=-c
  22. OutputFile :=../bin/$(Platform)/libsnap7.so
  23. PreprocessOnlySwitch :=-E
  24. ObjectsFileList :="filelist.txt"
  25. MakeDirCommand :=mkdir -p
  26. LinkOptions := -O3
  27. IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../src/sys $(IncludeSwitch)../../src/core $(IncludeSwitch)../../src/lib
  28. Libs := $(LibrarySwitch)pthread $(LibrarySwitch)nsl $(LibrarySwitch)socket
  29. LibPath := $(LibraryPathSwitch).
  30. LibInstall := /usr/lib
  31. ##
  32. ## Common variables (CXXFLAGS varies across platforms)
  33. ##
  34. AR := ar rcus
  35. CXX := g++ -m64
  36. CC := gcc
  37. CFLAGS :=
  38. ##
  39. ## User defined environment variables
  40. ##
  41. Objects0=$(IntermediateDirectory)/sys_snap_msgsock.o $(IntermediateDirectory)/sys_snap_sysutils.o $(IntermediateDirectory)/sys_snap_tcpsrvr.o $(IntermediateDirectory)/sys_snap_threads.o $(IntermediateDirectory)/core_s7_client.o $(IntermediateDirectory)/core_s7_isotcp.o $(IntermediateDirectory)/core_s7_partner.o $(IntermediateDirectory)/core_s7_peer.o $(IntermediateDirectory)/core_s7_server.o $(IntermediateDirectory)/core_s7_text.o \
  42. $(IntermediateDirectory)/core_s7_micro_client.o $(IntermediateDirectory)/lib_snap7_libmain.o
  43. Objects=$(Objects0)
  44. ##
  45. ## Main Build Targets
  46. ##
  47. .PHONY: all clean install PreBuild PostBuild
  48. all: $(OutputFile)
  49. $(OutputFile): $(IntermediateDirectory)/.d $(Objects)
  50. @$(MakeDirCommand) $(@D)
  51. @$(MakeDirCommand) $(IntermediateDirectory)
  52. @echo $(Objects0) > $(ObjectsFileList)
  53. $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)
  54. $(RM) $(ObjectsFileList)
  55. $(IntermediateDirectory)/.d:
  56. @test -d ../temp/$(TargetCPU) || $(MakeDirCommand) ../temp/$(TargetCPU)
  57. PreBuild:
  58. PostBuild:
  59. ##
  60. ## Objects
  61. ##
  62. $(IntermediateDirectory)/sys_snap_msgsock.o:
  63. $(CXX) $(SourceSwitch) "../../src/sys/snap_msgsock.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_msgsock.o $(IncludePath)
  64. $(IntermediateDirectory)/sys_snap_sysutils.o:
  65. $(CXX) $(SourceSwitch) "../../src/sys/snap_sysutils.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_sysutils.o $(IncludePath)
  66. $(IntermediateDirectory)/sys_snap_tcpsrvr.o:
  67. $(CXX) $(SourceSwitch) "../../src/sys/snap_tcpsrvr.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_tcpsrvr.o $(IncludePath)
  68. $(IntermediateDirectory)/sys_snap_threads.o:
  69. $(CXX) $(SourceSwitch) "../../src/sys/snap_threads.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/sys_snap_threads.o $(IncludePath)
  70. $(IntermediateDirectory)/core_s7_client.o:
  71. $(CXX) $(SourceSwitch) "../../src/core/s7_client.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_client.o $(IncludePath)
  72. $(IntermediateDirectory)/core_s7_isotcp.o:
  73. $(CXX) $(SourceSwitch) "../../src/core/s7_isotcp.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_isotcp.o $(IncludePath)
  74. $(IntermediateDirectory)/core_s7_partner.o:
  75. $(CXX) $(SourceSwitch) "../../src/core/s7_partner.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_partner.o $(IncludePath)
  76. $(IntermediateDirectory)/core_s7_peer.o:
  77. $(CXX) $(SourceSwitch) "../../src/core/s7_peer.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_peer.o $(IncludePath)
  78. $(IntermediateDirectory)/core_s7_server.o:
  79. $(CXX) $(SourceSwitch) "../../src/core/s7_server.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_server.o $(IncludePath)
  80. $(IntermediateDirectory)/core_s7_text.o:
  81. $(CXX) $(SourceSwitch) "../../src/core/s7_text.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_text.o $(IncludePath)
  82. $(IntermediateDirectory)/core_s7_micro_client.o:
  83. $(CXX) $(SourceSwitch) "../../src/core/s7_micro_client.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/core_s7_micro_client.o $(IncludePath)
  84. $(IntermediateDirectory)/lib_snap7_libmain.o:
  85. $(CXX) $(SourceSwitch) "../../src/lib/snap7_libmain.cpp" $(CXXFLAGS) -o $(IntermediateDirectory)/lib_snap7_libmain.o $(IncludePath)
  86. ##
  87. ## Clean / Install
  88. ##
  89. clean:
  90. $(RM) $(IntermediateDirectory)/*.o
  91. $(RM) $(OutputFile)
  92. install: all
  93. cp -f $(OutputFile) $(LibInstall)