-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
70 lines (49 loc) · 1.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# try to do some autodetecting
UNAME := $(shell uname -s)
ARCH := $(shell uname -m)
ifeq "$(UNAME)" "Darwin"
OS=macos
endif
ifeq "$(OS)" "Windows_NT"
OS=windows
endif
ifeq "$(UNAME)" "Linux"
OS=linux
endif
# deal with stupid Windows not having 'cc'
ifeq (default,$(origin CC))
CC = gcc
endif
############# Mac
ifeq "$(OS)" "macos"
CFLAGS+=`pkg-config hidapi --cflags`
LIBS=-lhidapi -framework IOKit -framework CoreFoundation -framework AppKit
EXE=
endif
############# Windows
ifeq "$(OS)" "windows"
CFLAGS+=`pkg-config hidapi --cflags`
LIBS+= -lhidapi -lsetupapi -Wl,--enable-auto-import
EXE=.exe
endif
############ Linux (hidraw)
ifeq "$(OS)" "linux"
LIBS = `pkg-config libudev --libs`
CFLAGS+=`pkg-config hidapi-libusb --cflags`
LIBS+=`pkg-config hidapi-libusb --libs`
EXE=
endif
############# common
CFLAGS+=-Wall
OBJS += sonixflasher.o
all: sonixflasher
$(OBJS): %.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
sonixflasher: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o sonixflasher$(EXE) $(LIBS)
clean:
rm -f $(OBJS)
rm -f sonixflasher$(EXE)
package: sonixflasher$(EXE)
@echo "Packaging up sonixflasher for '$(OS)-$(ARCH)'"
7z a sonixflasher-$(OS)-$(ARCH).zip sonixflasher$(EXE)