scsi2sd-util crash on exit fix (again)
[SCSI2SD-V6.git] / software / scsi2sd-util / Makefile
old mode 100644 (file)
new mode 100755 (executable)
index d765125..d84529c
@@ -1,10 +1,18 @@
 VPATH=cybootloaderutils ../SCSI2SD/src
 
-CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi -I wxWidgets/include -I ../include -Ilibzipper-1.0.3 -I$(BUILD)/zlib
+CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi -I ../include -Ilibzipper-1.0.4 -I$(BUILD)/zlib
 CFLAGS += -Wall -Wno-pointer-sign -O2 -g
 CXXFLAGS += -Wall -O2 -g -std=c++0x
 LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper -L$(BUILD)/zlib -lz
 
+LIBZIPPER_CONFIG = --disable-shared LDFLAGS="-L../zlib" CPPFLAGS="-I../zlib"
+
+# wxWidgets 3.0.2 uses broken Webkit headers under OSX Yosemeti
+# liblzma not available on OSX 10.7
+WX_CONFIG=--disable-webkit --disable-webviewwebkit  \
+       --without-libtiff --without-libjbig --without-liblzma --without-opengl \
+       --enable-monolithic --enable-stl --disable-shared
+
 TARGET ?= $(shell uname -s)
 ifeq ($(TARGET),Win32)
        VPATH += hidapi/windows
@@ -12,8 +20,9 @@ ifeq ($(TARGET),Win32)
        BUILD = build/windows/32bit
        CC=i686-w64-mingw32-gcc
        CXX=i686-w64-mingw32-g++
+       LIBZIPPER_CONFIG+=--host=i686-w64-mingw32
        EXE=.exe
-       WX_CONFIG=--host=i686-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
+       WX_CONFIG+=--host=i686-w64-mingw32
 endif
 ifeq ($(TARGET),Win64)
        VPATH += hidapi/windows
@@ -21,28 +30,28 @@ ifeq ($(TARGET),Win64)
        BUILD = build/windows/64bit
        CC=x86_64-w64-mingw32-gcc
        CXX=x86_64-w64-mingw32-g++
+       LIBZIPPER_CONFIG+=--host=x86_64-w64-mingw32
        EXE=.exe
-       WX_CONFIG=--host=x86_64-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
+       WX_CONFIG+=--host=x86_64-w64-mingw32
 endif
 ifeq ($(TARGET),Linux)
        VPATH += hidapi/linux
-       LDFLAGS += -ludev
+       LDFLAGS += -ludev -lexpat
        BUILD = build/linux
-       WX_CONFIG=--enable-monolithic --enable-stl
 endif
 ifeq ($(TARGET),Darwin)
        # Should match OSX
        VPATH += hidapi-mac
-       LDFLAGS += -framework IOKit -framework CoreFoundation
-       CFLAGS += -mmacosx-version-min=10.7
-       CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7
-       CC=clang
-       CXX=clang++
+       LDFLAGS += -framework IOKit -framework CoreFoundation -lexpat
+       CC=clang -mmacosx-version-min=10.7
+       CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7
+       WX_CONFIG += --with-macosx-version-min=10.7
        BUILD=build/mac
-       WX_CONFIG=--enable-monolithic --enable-stl --disable-shared
 endif
 
-all:  $(BUILD)/scsi2sd-util$(EXE)
+export CC CXX
+
+all:  $(BUILD)/scsi2sd-util$(EXE) $(BUILD)/scsi2sd-monitor$(EXE)
 
 CYAPI = \
        $(BUILD)/cybtldr_api2.o \
@@ -57,7 +66,6 @@ HIDAPI = \
 
 OBJ = \
        $(CYAPI) $(HIDAPI) \
-       $(BUILD)/scsi2sd-util.o \
        $(BUILD)/ConfigUtil.o \
        $(BUILD)/Firmware.o \
        $(BUILD)/TargetPanel.o \
@@ -65,8 +73,14 @@ OBJ = \
        $(BUILD)/SCSI2SD_HID.o \
        $(BUILD)/hidpacket.o \
 
+EXEOBJ = \
+       $(BUILD)/scsi2sd-util.o \
+       $(BUILD)/scsi2sd-monitor.o \
+
+
 
 $(OBJ): $(BUILD)/zlib/buildstamp
+$(EXEOBJ): $(BUILD)/zlib/buildstamp
 $(BUILD)/zlib/buildstamp:
        mkdir -p $(dir $@)
        ( \
@@ -78,22 +92,24 @@ $(BUILD)/zlib/buildstamp:
        touch $@
 
 $(OBJ): $(BUILD)/wx.buildstamp
+$(EXEOBJ): $(BUILD)/wx.buildstamp
 $(BUILD)/wx.buildstamp: $(BUILD)/zlib/buildstamp
        mkdir -p $(dir $@)
        ( \
                cd $(BUILD) && \
-               $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS=-I$(BUILD)/zlib LDFLAGS=-I$(BUILD)/zlib && \
+               $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS=-I../zlib LDFLAGS=-I../zlib && \
                $(MAKE) \
        ) && \
        touch $@
 
 $(OBJ): $(BUILD)/libzipper/buildstamp
-$(BUILD)/libzipper/buildstamp:
+$(EXEOBJ): $(BUILD)/libzipper/buildstamp
+$(BUILD)/libzipper/buildstamp: $(BUILD)/zlib/buildstamp
        mkdir -p $(dir $@)
        ( \
                cd $(dir $@) && \
-               $(CURDIR)/libzipper-1.0.3/configure --disable-shared --enable-static && \
-               $(MAKE) \
+               $(CURDIR)/libzipper-1.0.4/configure ${LIBZIPPER_CONFIG} --disable-shared --enable-static && \
+               $(MAKE) libzipper.la \
        ) && \
        touch $@
 
@@ -105,7 +121,11 @@ $(BUILD)/%.o: %.cc
        mkdir -p $(dir $@)
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) `$(BUILD)/wx-config --cxxflags` $< -c -o $@
 
-$(BUILD)/scsi2sd-util$(EXE): $(OBJ)
+$(BUILD)/scsi2sd-util$(EXE): $(OBJ) $(BUILD)/scsi2sd-util.o
+       mkdir -p $(dir $@)
+       $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
+
+$(BUILD)/scsi2sd-monitor$(EXE): $(OBJ) $(BUILD)/scsi2sd-monitor.o
        mkdir -p $(dir $@)
        $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@