Merge scsi2sd-util GUI changes
[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
4 CFLAGS += -Wall -Wno-pointer-sign -O2 -g
5 CXXFLAGS += -Wall -O2 -g -std=c++0x
6
7 TARGET ?= $(shell uname -s)
8 ifeq ($(TARGET),Win32)
9         VPATH += hidapi/windows
10         LDFLAGS += -static -mconsole -mwindows -lsetupapi
11         BUILD = build/windows/32bit
12         CC=i686-w64-mingw32-gcc
13         CXX=i686-w64-mingw32-g++
14         EXE=.exe
15         WX_CONFIG=--host=i686-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
16 endif
17 ifeq ($(TARGET),Win64)
18         VPATH += hidapi/windows
19         LDFLAGS += -static -mconsole -mwindows -lsetupapi
20         BUILD = build/windows/64bit
21         CC=x86_64-w64-mingw32-gcc
22         CXX=x86_64-w64-mingw32-g++
23         EXE=.exe
24         WX_CONFIG=--host=x86_64-w64-mingw32 --enable-monolithic --enable-stl --disable-shared
25 endif
26 ifeq ($(TARGET),Linux)
27         VPATH += hidapi/linux
28         LDFLAGS += -ludev
29         BUILD = build/linux
30         WX_CONFIG=--enable-monolithic --enable-stl
31 endif
32 ifeq ($(TARGET),Darwin)
33         # Should match OSX
34         VPATH += hidapi-mac
35         LDFLAGS += -framework IOKit -framework CoreFoundation
36         CFLAGS += -mmacosx-version-min=10.7
37         CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7
38         CC=clang
39         CXX=clang++
40         BUILD=build/mac
41         WX_CONFIG=--enable-monolithic --enable-stl --disable-shared
42 endif
43
44 all:  $(BUILD)/scsi2sd-util$(EXE)
45
46 CYAPI = \
47         $(BUILD)/cybtldr_api2.o \
48         $(BUILD)/cybtldr_api.o \
49         $(BUILD)/cybtldr_command.o \
50         $(BUILD)/cybtldr_parse.o \
51
52
53 HIDAPI = \
54         $(BUILD)/hid.o \
55
56
57 OBJ = \
58         $(CYAPI) $(HIDAPI) \
59         $(BUILD)/scsi2sd-util.o \
60         $(BUILD)/ConfigUtil.o \
61         $(BUILD)/Firmware.o \
62         $(BUILD)/TargetPanel.o \
63         $(BUILD)/SCSI2SD_Bootloader.o \
64         $(BUILD)/SCSI2SD_HID.o \
65         $(BUILD)/hidpacket.o \
66
67
68 $(OBJ): $(BUILD)/wx.buildstamp
69 $(BUILD)/wx.buildstamp:
70         mkdir -p $(dir $@)
71         ( \
72                 cd $(BUILD) && \
73                 $(CURDIR)/wxWidgets/configure $(WX_CONFIG) && \
74                 $(MAKE) \
75         ) && \
76         touch $@
77
78 $(BUILD)/%.o: %.c
79         mkdir -p $(dir $@)
80         $(CC) $(CPPFLAGS) $(CFLAGS) $< -c -o $@
81
82 $(BUILD)/%.o: %.cc
83         mkdir -p $(dir $@)
84         $(CXX) $(CPPFLAGS) $(CXXFLAGS) `$(BUILD)/wx-config --cxxflags` $< -c -o $@
85
86 $(BUILD)/scsi2sd-util$(EXE): $(OBJ)
87         mkdir -p $(dir $@)
88         $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) `$(BUILD)/wx-config --libs` -o $@
89
90 clean:
91         rm $(BUILD)/scsi2sd-util$(EXE) $(OBJ)
92