summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-01-31 15:42:17 +0100
committerTom Smeding <tom@tomsmeding.com>2024-01-31 15:42:17 +0100
commit6060db32b949d62757b668f972648465f1e302c7 (patch)
tree53fcc624d250a7d42d15cfcae4909ed6c21dd3be /Makefile
Initial
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3003995
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,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 $(wildcard *.h) | $(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 >$@