Emulation of multiple SCSI targets now working.
[SCSI2SD-V6.git] / software / scsi2sd-util / Makefile
1 VPATH=cybootloaderutils ../SCSI2SD/src
2
3 CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi -I wxWidgets/include -I ../include -Ilibzipper-1.0.3 -I$(BUILD)/zlib
4 CFLAGS += -Wall -Wno-pointer-sign -O2 -g
5 CXXFLAGS += -Wall -O2 -g -std=c++0x
6 LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper -L$(BUILD)/zlib -lz
7
8 TARGET ?= $(shell uname -s)
9 ifeq ($(TARGET),Win32)
10         VPATH += hidapi/windows
11         LDFLAGS += -static -mconsole -mwindows -lsetupapi
12         BUILD = build/windows/32bit
13         CC=i686-w64-mingw32-gcc
14         CXX=i686-w64-mingw32-g++
15         EXE=.exe
16         WX_CONFIG=--host=i686-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
17 endif
18 ifeq ($(TARGET),Win64)
19         VPATH += hidapi/windows
20         LDFLAGS += -static -mconsole -mwindows -lsetupapi
21         BUILD = build/windows/64bit
22         CC=x86_64-w64-mingw32-gcc
23         CXX=x86_64-w64-mingw32-g++
24         EXE=.exe
25         WX_CONFIG=--host=x86_64-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
26 endif
27 ifeq ($(TARGET),Linux)
28         VPATH += hidapi/linux
29         LDFLAGS += -ludev
30         BUILD = build/linux
31         WX_CONFIG=--enable-monolithic --enable-stl
32 endif
33 ifeq ($(TARGET),Darwin)
34         # Should match OSX
35         VPATH += hidapi-mac
36         LDFLAGS += -framework IOKit -framework CoreFoundation
37         CFLAGS += -mmacosx-version-min=10.7
38         CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7
39         CC=clang
40         CXX=clang++
41         BUILD=build/mac
42         WX_CONFIG=--enable-monolithic --enable-stl --disable-shared
43 endif
44
45 all:  $(BUILD)/scsi2sd-util$(EXE)
46
47 CYAPI = \
48         $(BUILD)/cybtldr_api2.o \
49         $(BUILD)/cybtldr_api.o \
50         $(BUILD)/cybtldr_command.o \
51         $(BUILD)/cybtldr_parse.o \
52
53
54 HIDAPI = \
55         $(BUILD)/hid.o \
56
57
58 OBJ = \
59         $(CYAPI) $(HIDAPI) \
60         $(BUILD)/scsi2sd-util.o \
61         $(BUILD)/ConfigUtil.o \
62         $(BUILD)/Firmware.o \
63         $(BUILD)/TargetPanel.o \
64         $(BUILD)/SCSI2SD_Bootloader.o \
65         $(BUILD)/SCSI2SD_HID.o \
66         $(BUILD)/hidpacket.o \
67
68
69 $(OBJ): $(BUILD)/zlib/buildstamp
70 $(BUILD)/zlib/buildstamp:
71         mkdir -p $(dir $@)
72         ( \
73                 cd $(dir $@) && \
74                 cp -a $(CURDIR)/zlib-1.2.8/* . && \
75                 ./configure --static && \
76                 $(MAKE) \
77         ) && \
78         touch $@
79
80 $(OBJ): $(BUILD)/wx.buildstamp
81 $(BUILD)/wx.buildstamp: $(BUILD)/zlib/buildstamp
82         mkdir -p $(dir $@)
83         ( \
84                 cd $(BUILD) && \
85                 $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS=-I$(BUILD)/zlib LDFLAGS=-I$(BUILD)/zlib && \
86                 $(MAKE) \
87         ) && \
88         touch $@
89
90 $(OBJ): $(BUILD)/libzipper/buildstamp
91 $(BUILD)/libzipper/buildstamp:
92         mkdir -p $(dir $@)
93         ( \
94                 cd $(dir $@) && \
95                 $(CURDIR)/libzipper-1.0.3/configure --disable-shared --enable-static && \
96                 $(MAKE) \
97         ) && \
98         touch $@
99
100 $(BUILD)/%.o: %.c
101         mkdir -p $(dir $@)
102         $(CC) $(CPPFLAGS) $(CFLAGS) $< -c -o $@
103
104 $(BUILD)/%.o: %.cc
105         mkdir -p $(dir $@)
106         $(CXX) $(CPPFLAGS) $(CXXFLAGS) `$(BUILD)/wx-config --cxxflags` $< -c -o $@
107
108 $(BUILD)/scsi2sd-util$(EXE): $(OBJ)
109         mkdir -p $(dir $@)
110         $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
111
112 clean:
113         rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ) $(BUILD)/libzipper/buildstamp
114