summaryrefslogtreecommitdiff
path: root/Makefile
blob: 31a3465a1e83a1a4921e96f45a9137a7b0f03850 (plain)
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
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++17 -O2 -g
LDFLAGS = -lX11
TARGET = blockuntilkey

# 'sort' removes duplicates
SOURCES := $(sort $(wildcard *.cpp) keysym_table.cpp)
HEADERS := $(sort $(wildcard *.cpp) keysym_table.h)

OBJDIR = obj

.PHONY: all clean

all: $(TARGET)

clean:
	@echo "Cleaning"
	@rm -f $(TARGET)
	@rm -rf $(OBJDIR)


$(OBJDIR)/%.o: %.cpp $(HEADERS) | $(OBJDIR)
	@echo "CXX $<"
	@$(CXX) $(CXXFLAGS) -c -o $@ $<

$(TARGET): $(patsubst %.cpp,$(OBJDIR)/%.o,$(SOURCES)) | $(OBJDIR)
	@echo "LD -o $@"
	@$(CXX) -o $@ $^ $(LDFLAGS)

$(OBJDIR):
	@mkdir -p $(OBJDIR)


keysym_table.h: make_keysym_table.sh /usr/include/xkbcommon/xkbcommon-keysyms.h
	./make_keysym_table.sh --header >$@

keysym_table.cpp: make_keysym_table.sh /usr/include/xkbcommon/xkbcommon-keysyms.h
	./make_keysym_table.sh --source >$@