aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..fb66c1a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+WIN ?= X11
+
+CC=gcc
+CFLAGS=$(shell pkg-config --cflags cairo)
+LFLAGS=$(shell pkg-config --libs cairo)
+
+BIN=dav
+SRC_DIR=./src
+SRC_FILES=$(wildcard $(SRC_DIR)/*.c)
+OBJ_FILES=$(patsubst %.c, %.o, $(SRC_FILES))
+
+
+ifeq ($(WIN), X11)
+ WIN_SYS=$(WIN)
+ LFLAGS += -lX11 -lXcomposite -lXfixes
+endif
+
+ifeq ($(WIN), Wayland)
+ WIN_SYS=$(WIN)
+endif
+
+ifeq ($(WIN), WinAPI)
+ WIN_SYS=$(WIN)
+endif
+
+
+ifndef WIN_SYS
+$(error WIN available: "X11", "Wayland", "WinAPI")
+endif
+
+
+all: $(BIN)
+
+%.o: %.c
+ $(CC) -D$(WIN) $(CFLAGS) -c $< -o $@
+
+$(BIN): $(OBJ_FILES)
+ $(CC) -D$(WIN) $(CFLAGS) -o $@ $^ $(LFLAGS)
+
+run: $(BIN)
+ ./$(BIN)
+
+clean:
+ rm -f $(BIN) $(OBJ_FILES)