2024-04-30 18:17:17 +02:00
|
|
|
.POSIX:
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
VERSION = 1.0
|
2024-09-16 14:11:01 +02:00
|
|
|
SERVER = zmr
|
|
|
|
CLIENT = zen
|
|
|
|
TARGET = zsm
|
2024-04-30 18:17:17 +02:00
|
|
|
MANPAGE = $(TARGET).1
|
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
MANDIR = $(PREFIX)/share/man/man1
|
|
|
|
|
2024-11-05 01:20:43 +01:00
|
|
|
LDFLAGS != pkg-config --libs libsodium libnotify ncurses sqlite3
|
|
|
|
INCFLAGS != pkg-config --cflags libsodium libnotify ncurses sqlite3
|
|
|
|
CFLAGS = -Os -mtune=native -march=native -pipe -g -std=c99 -Wno-pointer-sign -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $(INCFLAGS) -lpthread -lluft -L.
|
2024-04-30 18:17:17 +02:00
|
|
|
|
2024-11-05 01:20:43 +01:00
|
|
|
SERVERSRC != find src/zmr -name "*.c"
|
|
|
|
CLIENTSRC != find src/zen -name "*.c"
|
|
|
|
LIBSRC != find src/lib -name "*.c"
|
|
|
|
INCLUDE = include
|
2024-04-30 18:17:17 +02:00
|
|
|
|
2024-09-16 14:11:01 +02:00
|
|
|
all: $(SERVER) $(CLIENT)
|
|
|
|
|
2024-04-30 18:17:17 +02:00
|
|
|
$(SERVER): $(SERVERSRC) $(LIBSRC)
|
2024-09-16 14:11:01 +02:00
|
|
|
mkdir -p bin
|
2024-11-05 01:20:43 +01:00
|
|
|
$(CC) $(SERVERSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS)
|
2024-04-30 18:17:17 +02:00
|
|
|
|
|
|
|
$(CLIENT): $(CLIENTSRC) $(LIBSRC)
|
2024-09-16 14:11:01 +02:00
|
|
|
mkdir -p bin
|
2024-11-05 01:20:43 +01:00
|
|
|
$(CC) $(CLIENTSRC) $(LIBSRC) -I$(INCLUDE) -I. -o bin/$@ $(CFLAGS) $(LDFLAGS)
|
2024-04-30 18:17:17 +02:00
|
|
|
|
|
|
|
dist:
|
|
|
|
mkdir -p $(TARGET)-$(VERSION)
|
2024-10-12 23:04:02 +02:00
|
|
|
cp -R README.md $(MANPAGE) bin/$(SERVER) bin/$(CLIENT) $(TARGET)-$(VERSION)
|
2024-04-30 18:17:17 +02:00
|
|
|
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
|
|
|
|
gzip $(TARGET)-$(VERSION).tar
|
|
|
|
rm -rf $(TARGET)-$(VERSION)
|
|
|
|
|
|
|
|
install: $(TARGET)
|
|
|
|
mkdir -p $(DESTDIR)$(BINDIR)
|
|
|
|
mkdir -p $(DESTDIR)$(MANDIR)
|
2024-09-16 14:11:01 +02:00
|
|
|
cp -p bin/$(TARGET) $(DESTDIR)$(BINDIR)/$(SERVER)
|
|
|
|
chmod 755 $(DESTDIR)$(BINDIR)/$(SERVER)
|
|
|
|
cp -p bin/$(TARGET) $(DESTDIR)$(BINDIR)/$(CLIENT)
|
|
|
|
chmod 755 $(DESTDIR)$(BINDIR)/$(CLIENT)
|
2024-04-30 18:17:17 +02:00
|
|
|
cp -p $(MANPAGE) $(DESTDIR)$(MANDIR)/$(MANPAGE)
|
|
|
|
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
|
|
|
|
|
|
|
|
uninstall:
|
2024-11-05 01:20:43 +01:00
|
|
|
rm $(DESTDIR)$(BINDIR)/$(SERVER)
|
|
|
|
rm $(DESTDIR)$(BINDIR)/$(CLIENT)
|
|
|
|
rm $(DESTDIR)$(MANDIR)/$(MANPAGE)
|
2024-04-30 18:17:17 +02:00
|
|
|
|
|
|
|
clean:
|
2024-11-05 01:20:43 +01:00
|
|
|
rm $(SERVER) $(CLIENT)
|
2024-04-30 18:17:17 +02:00
|
|
|
|
|
|
|
.PHONY: all dist install uninstall clean
|