aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-08-29 15:44:43 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-08-29 18:51:31 +0200
commit99561277e31caeffa7fc9d722650247511ad3bf7 (patch)
treee198e15d47d873624ba4f00e234ed3b3fa0d466d /Makefile
parentbe775d4675b19b7f033c01f6826da11b16d7288b (diff)
Refactoring to a C Binary
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 21 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 7377817..6f6f205 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,26 @@
-DBX_IMAGE ?= dbx
+CC = cc
+CFLAGS = -Wall -Wextra -O2
+LDFLAGS =
+
+SRCS = $(shell find src -name '*.c')
+OBJS = $(patsubst %.c,%.o,$(SRCS))
+
+CONTAINER = $(if $(findstring Darwin,$(shell uname -s)),container,podman)
+IMAGE = dbx-next
.PHONY: all
-all: .container ssh/id_ed25519 ;
+all: dbx ;
+
+dbx: $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
-.PHONY: install
-install: all
- mkdir -p $(HOME)/.local/bin
- ln -s $(PWD)/dbx $(HOME)/.local/bin/dbx
+%.o: %.c src/dbx.h
+ $(CC) $(CFLAGS) -c -o $@ $<
-.container: Containerfile dbx-init ssh/id_ed25519.pub
- container build --pull --tag $(DBX_IMAGE) .
- touch $@
+.PHONY: container
+container: container/Containerfile container/init
+ $(CONTAINER) build --tag $(IMAGE) container
-ssh/id_% ssh/id_%.pub:
- ssh-keygen -C "$$(id -un)@$$(hostname)" -f ssh/id_$* -N "" -t $*
+.PHONY: clean
+clean:
+ rm -f dbx src/*.o