-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (54 loc) · 1.17 KB
/
Makefile
File metadata and controls
77 lines (54 loc) · 1.17 KB
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
71
72
73
74
75
76
77
#
# Makefile for 'litra'
# 2022 Chris Jones
# @IPv6Freely
#
HIDAPI_DIR ?= ../hidapi
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+=-arch x86_64 -arch arm64
LIBS=-framework IOKit -framework CoreFoundation -framework AppKit
OBJS=$(HIDAPI_DIR)/mac/hid.o
EXE=
endif
############# Windows
ifeq "$(OS)" "windows"
LIBS += -lsetupapi -Wl,--enable-auto-import -static-libgcc -static-libstdc++
OBJS = $(HIDAPI_DIR)/windows/hid.o
EXE=.exe
endif
############ Linux (hidraw)
ifeq "$(OS)" "linux"
LIBS = `pkg-config libudev --libs`
OBJS = $(HIDAPI_DIR)/linux/hid.o
EXE=
endif
############# common
CFLAGS+=-I $(HIDAPI_DIR)/hidapi
OBJS += litra.o
all: litra
$(OBJS): %.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
litra: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o litra$(EXE) $(LIBS)
clean:
rm -f $(OBJS)
rm -f litra$(EXE)
package: litra$(EXE)
@echo "Packaging up litra for '$(OS)-$(ARCH)'"
zip litra-$(OS)-$(ARCH).zip litra$(EXE)