forked from mrlioncub/bmcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (38 loc) · 965 Bytes
/
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
APP = bmcontrol
CFLAGS = -Wall -pedantic -O2 -Iinclude $(shell pkg-config --cflags libusb)
LDFLAGS = $(shell pkg-config --libs libusb)
OBJS = src/main.o
ifeq ($(OS),Windows_NT)
fix_path = $(subst /,\,$1)
RM = del /Q
CP = copy /Y
MKDIR = mkdir
BIN = $(APP).exe
OBJS += src/win32/nanosleep.o
PREFIX ?= "C:\Program Files\BMControl"
PREFIX_BIN = $(PREFIX)
else
ifneq ($(shell uname -s),Linux)
$(warning *** (warning) Currently only Linux and Windows build is supported. \
Trying to use the same build configuration as on Linux)
endif
fix_path = $1
CFLAGS += -std=c99 -D_POSIX_C_SOURCE=199309L
RM = rm -f
CP = install -m 0755
MKDIR = mkdir -p
BIN = $(APP)
PREFIX ?= /usr/local
PREFIX_BIN = $(PREFIX)/bin
endif
default: $(BIN)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
$(BIN): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
clean:
$(RM) $(BIN) $(call fix_path,$(OBJS))
install:
$(MKDIR) $(PREFIX_BIN)
$(CP) $(BIN) $(PREFIX_BIN)
.PHONY: default clean install