forked from Gibtnix/MSIKLM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·56 lines (41 loc) · 1.3 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
#############################################################################
# Makefile for building MSI Keyboard Light Manager (MSIKLM)
#############################################################################
####### Compiler, tools and options
TARGET = msiklm
CC = gcc
CFLAGS = -m64 -pipe -O3 -Wall -W -D_REENTRANT
LFLAGS = -m64 -Wl,-O3
LIBS = -lhidapi-libusb
DEL_FILE = rm -f
INSTALLPREFIX = /usr/local/bin
####### Files
INC_DIR = src
INC_FILE = msiklm.h
SRC_DIR = src
SRC_FILE = main.c \
msiklm.c
OBJ_DIR = .obj
OBJ_FILE = $(SRC_FILE:.c=.o)
CRT_DIR = .
SRC = $(addprefix $(SRC_DIR)/,$(SRC_FILE))
INC = $(addprefix $(INC_DIR)/,$(INC_FILE))
OBJ = $(addprefix $(OBJ_DIR)/,$(OBJ_FILE))
CRT = $(addprefix $(OBJ_DIR)/,$(CRT_DIR))
####### Build rules
all: $(TARGET)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(INC) Makefile
@mkdir -p $(CRT) 2> /dev/null || true
$(CC) $(CFLAGS) -c $< -o $@
$(TARGET): $(OBJ)
$(CC) $(LFLAGS) -o $(TARGET) $(OBJ) $(LIBS)
clean:
$(DEL_FILE) $(OBJ)
$(DEL_FILE) -r $(OBJ_DIR)
delete: clean
$(DEL_FILE) $(TARGET)
install: all
@cp -v $(TARGET) $(INSTALLPREFIX)/$(TARGET)
@chmod 755 $(INSTALLPREFIX)/$(TARGET)
re: delete all
.PHONY: all clean delete re