-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
50 lines (35 loc) · 1.27 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
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
PREFIX ?= /usr
CPPFLAGS += -fno-rtti -fno-exceptions -fno-threadsafe-statics \
-pipe -Wconversion-null -O2
CC = gcc
CFLAGS += -O3 -flto
CPP = gcc
all : $(BUILD_DIR) $(BUILD_DIR)/evdoublebind $(BUILD_DIR)/evdoublebind-inspector $(BUILD_DIR)/evdoublebind-make-config
$(BUILD_DIR):
$(MKDIR_P) $(BUILD_DIR)
$(BUILD_DIR)/evdoublebind: $(SRC_DIRS)/evdoublebind.c
$(CC) $(CFLAGS) $(SRC_DIRS)/evdoublebind.c -o $@
$(BUILD_DIR)/evdoublebind-inspector: $(SRC_DIRS)/inspector.cc
$(CPP) $(CPPFLAGS) $(SRC_DIRS)/inspector.cc -o $@ -lxkbcommon
$(BUILD_DIR)/evdoublebind-make-config: $(SRC_DIRS)/make_config.cc
$(CPP) $(CPPFLAGS) $(SRC_DIRS)/make_config.cc -o $@ -lxkbcommon
$(BUILD_DIR)/%.cc.o: %.cc
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.PHONY: install
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
install $(BUILD_DIR)/* $(DESTDIR)$(PREFIX)/bin/
chmod 'g+s' $(DESTDIR)$(PREFIX)/bin/evdoublebind
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/evdoublebind $(DESTDIR)$(PREFIX)/bin/evdoublebind-inspector $(DESTDIR)$(PREFIX)/bin/evdoublebind-make-config
.PHONY: musl-static
musl-static: CC = musl-gcc -O3 -static -Wl,-z,noseparate-code
musl-static: all
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p