56908797b4da90a6ee863c7f81492c02a6a693a5
[SCSI2SD-V6.git] / software / scsi2sd-debug / Makefile
1
2 CPPFLAGS = -I ../bootloaderhost/hidapi/hidapi -I ../bootloaderhost
3 CFLAGS += -Wall -Wno-pointer-sign -O2
4 CXXFLAGS += -Wall -O2
5 VPATH += ../bootloaderhost
6
7 TARGET ?= $(shell uname -s)
8 ifeq ($(TARGET),Win32)
9         VPATH += hidapi/windows
10         LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
11         BUILD = build/windows/32bit
12         CC=i686-w64-mingw32-gcc
13         CXX=i686-w64-mingw32-g++
14         EXE=.exe
15 endif
16 ifeq ($(TARGET),Win64)
17         VPATH += hidapi/windows
18         LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
19         BUILD = build/windows/64bit
20         CC=x86_64-w64-mingw32-gcc
21         CXX=x86_64-w64-mingw32-g++
22         EXE=.exe
23 endif
24 ifeq ($(TARGET),Linux)
25         VPATH += hidapi/linux
26         LDFLAGS += -ludev
27         BUILD = build/linux
28 endif
29 ifeq ($(TARGET),Darwin)
30         # Should match OSX
31         VPATH += ../bootloaderhost/hidapi-mac
32         LDFLAGS += -framework IOKit -framework CoreFoundation
33         CFLAGS += -mmacosx-version-min=10.7
34         CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7 -std=c++0x
35         CC=clang
36         CXX=clang++
37         BUILD=build/mac
38 endif
39
40 all:  $(BUILD)/scsi2sd-debug$(EXE)
41
42 HIDAPI = \
43         $(BUILD)/hid.o \
44
45 OBJ = \
46         $(HIDAPI) \
47         $(BUILD)/scsi2sd-debug.o \
48         $(BUILD)/SCSI2SD_HID.o \
49
50 $(BUILD)/%.o: %.c
51         mkdir -p $(dir $@)
52         $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c -o $@
53
54 $(BUILD)/%.o: %.cc
55         mkdir -p $(dir $@)
56         $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -c -o $@
57
58 $(BUILD)/scsi2sd-debug$(EXE): $(OBJ)
59         mkdir -p $(dir $@)
60         $(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
61
62 clean:
63         rm $(BUILD)/scsi2sd-debug$(EXE) $(OBJ)