Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. VPATH=cybootloaderutils ../SCSI2SD/src
  2. ifeq ($(USE_SYSTEM), Yes)
  3. USE_SYSTEM_HIDAPI = Yes
  4. USE_SYSTEM_ZLIB = Yes
  5. USE_SYSTEM_WX = Yes
  6. endif
  7. CPPFLAGS_HIDAPI=$(shell pkg-config hidapi-hidraw --cflags)
  8. CPPFLAGS_ZLIB=$(shell pkg-config zlib --cflags)
  9. CPPFLAGS = -I cybootloaderutils $(CPPFLAGS_HIDAPI) -I ../include -Ilibzipper-1.0.4 $(CPPFLAGS_ZLIB)
  10. CFLAGS += -Wall -Wno-pointer-sign -O2 -g
  11. CXXFLAGS += -Wall -O2 -g -std=c++0x
  12. LDFLAGS_ZLIB=$(shell pkg-config zlib --libs)
  13. LDFLAGS_HIDAPI=$(shell pkg-config hidapi-hidraw --libs)
  14. LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper $(LDFLAGS_ZLIB) $(LDFLAGS_HIDAPI)
  15. LIBZIPPER_CONFIG = --disable-shared LDFLAGS="$(LDFLAGS_ZLIB)" CPPFLAGS="$(CPPFLAGS_ZLIB)"
  16. # wxWidgets 3.0.2 uses broken Webkit headers under OSX Yosemeti
  17. # liblzma not available on OSX 10.7
  18. WX_CONFIG=--disable-webkit --disable-webviewwebkit \
  19. --without-libtiff --without-libjbig --without-liblzma --without-opengl \
  20. --enable-monolithic --enable-stl --disable-shared
  21. TARGET ?= $(shell uname -s)
  22. ifeq ($(TARGET),Win32)
  23. VPATH += hidapi/windows
  24. LDFLAGS += -static -mconsole -mwindows -lsetupapi
  25. BUILD = build/windows/32bit
  26. CC=i686-w64-mingw32-gcc
  27. CXX=i686-w64-mingw32-g++
  28. LIBZIPPER_CONFIG+=--host=i686-w64-mingw32
  29. EXE=.exe
  30. WX_CONFIG+=--host=i686-w64-mingw32
  31. endif
  32. ifeq ($(TARGET),Win64)
  33. VPATH += hidapi/windows
  34. LDFLAGS += -static -mconsole -mwindows -lsetupapi
  35. BUILD = build/windows/64bit
  36. CC=x86_64-w64-mingw32-gcc
  37. CXX=x86_64-w64-mingw32-g++
  38. LIBZIPPER_CONFIG+=--host=x86_64-w64-mingw32
  39. EXE=.exe
  40. WX_CONFIG+=--host=x86_64-w64-mingw32
  41. endif
  42. ifeq ($(TARGET),Linux)
  43. VPATH += hidapi/linux
  44. LDFLAGS += -ludev -lexpat
  45. BUILD = build/linux
  46. endif
  47. ifeq ($(TARGET),Darwin)
  48. # Should match OSX
  49. VPATH += hidapi-mac
  50. LDFLAGS += -framework IOKit -framework CoreFoundation -lexpat
  51. CC=clang -mmacosx-version-min=10.7
  52. CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7
  53. WX_CONFIG += --with-macosx-version-min=10.7
  54. BUILD=build/mac
  55. endif
  56. export CC CXX
  57. all: $(BUILD)/scsi2sd-util$(EXE) $(BUILD)/scsi2sd-monitor$(EXE)
  58. CYAPI = \
  59. $(BUILD)/cybtldr_api2.o \
  60. $(BUILD)/cybtldr_api.o \
  61. $(BUILD)/cybtldr_command.o \
  62. $(BUILD)/cybtldr_parse.o \
  63. ifneq ($(USE_SYSTEM_HIDAPI),Yes)
  64. HIDAPI = \
  65. $(BUILD)/hid.o
  66. endif
  67. OBJ = \
  68. $(CYAPI) $(HIDAPI) \
  69. $(BUILD)/ConfigUtil.o \
  70. $(BUILD)/Firmware.o \
  71. $(BUILD)/TargetPanel.o \
  72. $(BUILD)/SCSI2SD_Bootloader.o \
  73. $(BUILD)/SCSI2SD_HID.o \
  74. $(BUILD)/hidpacket.o \
  75. EXEOBJ = \
  76. $(BUILD)/scsi2sd-util.o \
  77. $(BUILD)/scsi2sd-monitor.o \
  78. ifneq ($(USE_SYSTEM_ZLIB),Yes)
  79. $(OBJ): $(BUILD)/zlib/buildstamp
  80. $(EXEOBJ): $(BUILD)/zlib/buildstamp
  81. $(BUILD)/zlib/buildstamp:
  82. mkdir -p $(dir $@)
  83. ( \
  84. cd $(dir $@) && \
  85. cp -a $(CURDIR)/zlib-1.2.8/* . && \
  86. ./configure --static && \
  87. $(MAKE) \
  88. ) && \
  89. touch $@
  90. endif
  91. ifneq ($(USE_SYSTEM_WX),Yes)
  92. $(OBJ): $(BUILD)/wx.buildstamp
  93. $(EXEOBJ): $(BUILD)/wx.buildstamp
  94. ifneq ($(USE_SYSTEM_ZLIB),Yes)
  95. $(BUILD)/wx.buildstamp: $(BUILD)/zlib/buildstamp
  96. else
  97. $(BUILD)/wx.buildstamp:
  98. endif
  99. mkdir -p $(dir $@)
  100. ( \
  101. cd $(BUILD) && \
  102. $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS="$(CPPFLAGS_ZLIB)" LDFLAGS="$(LDFLAGS_ZLIB)" && \
  103. $(MAKE) \
  104. ) && \
  105. touch $@
  106. endif
  107. ifneq ($(USE_SYSTEM_ZLIB),Yes)
  108. LIBZIPPER_STATIC=-enable-static
  109. endif
  110. $(OBJ): $(BUILD)/libzipper/buildstamp
  111. $(EXEOBJ): $(BUILD)/libzipper/buildstamp
  112. ifneq ($(USE_SYSTEM_ZLIB),Yes)
  113. $(BUILD)/libzipper/buildstamp: $(BUILD)/zlib/buildstamp
  114. else
  115. $(BUILD)/libzipper/buildstamp:
  116. endif
  117. mkdir -p $(dir $@)
  118. ( \
  119. cd $(dir $@) && \
  120. $(CURDIR)/libzipper-1.0.4/configure ${LIBZIPPER_CONFIG} --disable-shared $(LIBZIPPER_STATIC) && \
  121. $(MAKE) libzipper.la \
  122. ) && \
  123. touch $@
  124. $(BUILD)/%.o: %.c
  125. mkdir -p $(dir $@)
  126. $(CC) $(CPPFLAGS) $(CFLAGS) $< -c -o $@
  127. $(BUILD)/%.o: %.cc
  128. mkdir -p $(dir $@)
  129. ifneq ($(USE_SYSTEM_WX),Yes)
  130. $(CXX) $(CPPFLAGS) $(CXXFLAGS) `$(BUILD)/wx-config --cxxflags` $< -c -o $@
  131. else
  132. $(CXX) $(CPPFLAGS) $(CXXFLAGS) `wx-config-3.0 --cxxflags` $< -c -o $@
  133. endif
  134. $(BUILD)/scsi2sd-util$(EXE): $(OBJ) $(BUILD)/scsi2sd-util.o
  135. mkdir -p $(dir $@)
  136. ifneq ($(USE_SYSTEM_WX),Yes)
  137. $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
  138. else
  139. $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `wx-config-3.0 --libs` -o $@
  140. endif
  141. $(BUILD)/scsi2sd-monitor$(EXE): $(OBJ) $(BUILD)/scsi2sd-monitor.o
  142. mkdir -p $(dir $@)
  143. ifneq ($(USE_SYSTEM_WX),Yes)
  144. $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
  145. else
  146. $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `wx-config-3.0 --libs` -o $@
  147. endif
  148. clean:
  149. rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ) $(BUILD)/libzipper/buildstamp