aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiley Beckett <rbeckettvt@gmail.com>2025-10-08 21:31:14 -0400
committerRiley Beckett <rbeckettvt@gmail.com>2025-10-08 21:33:13 -0400
commit704ec4107d39022abf76a86982601fd36ff467ff (patch)
tree2133f341a38e6e7b33e8c5d14e357511ed843417
Inital Commit
-rw-r--r--.gitignore5
-rw-r--r--Makefile62
-rw-r--r--main.c5
3 files changed, 72 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..96bdd0c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+swenu
+
+objs/
+
+compile_flags.txt
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..300b4ce
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,62 @@
+BIN=swenu
+CC=gcc
+OBJDIR=objs
+LIBS=egl wayland-client gl wayland-egl xkbcommon
+CFLAGS=-Wall -g $(shell pkg-config --cflags $(LIBS)) -I$(OBJDIR)
+LDFLAGS=$(shell pkg-config --libs $(LIBS))
+VPATH=/usr/share/wayland-protocols/staging/cursor-shape/:/usr/share/wayland-protocols/stable/tablet/:$(OBJDIR)
+WLPROT=cursor-shape-v1.xml tablet-v2.xml
+WLC=$(patsubst %.xml,$(OBJDIR)/%.c, $(WLPROT))
+WLH=$(patsubst %.xml,$(OBJDIR)/%.h, $(WLPROT))
+SRC=$(WLC) $(wildcard *.c) $(wildcard glad/*.c)
+OBJ=$(patsubst %.c,$(OBJDIR)/%.o, $(notdir $(SRC)))
+
+.SILENT: $(OBJ) $(WLC) $(WLH) $(BIN) $(OBJDIR) compile_flags
+
+all: $(OBJDIR) $(BIN)
+
+$(OBJDIR):
+ [ -d $@ ] || mkdir -p $@
+
+$(BIN): $(OBJ)
+ printf " LD %s\n" $@
+ $(CC) $(LDFLAGS) $^ -o $@
+
+$(OBJDIR)/%.o: %.c %.h
+ printf " CC %s\n" $@
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/%.o: */%.c */%.h
+ printf " CC %s\n" $@
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/%.o: %.c
+ printf " CC %s\n" $@
+ $(CC) $(CFLAGS) -c $< -o $@
+
+.PRECIOUS: $(OBJDIR)/%.c
+$(OBJDIR)/%.c: %.xml $(OBJDIR)/%.h
+ printf " wayland-scanner %s\n" $@
+ wayland-scanner private-code $< $@
+
+.PRECIOUS: $(OBJDIR)/%.h
+$(OBJDIR)/%.h: %.xml
+ printf " wayland-scanner %s\n" $@
+ wayland-scanner client-header $< $@
+
+compile_flags:
+ echo $(CFLAGS) | tr ' ' '\n' > compile_flags.txt
+
+clean:
+ rm -rf $(BIN) $(OBJDIR)
+
+install: all
+ install -m 755 ./$(BIN) $(PREFIX)/usr/bin
+
+uninstall:
+ rm -rf $(PREFIX)/usr/bin/$(BIN)
+
+run: all
+ ./$(BIN)
+
+.PHONY: all clean run compile_flags install uninstall
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..11f7c99
--- /dev/null
+++ b/main.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int main() {
+ printf("hello world\n");
+}