zsm/Makefile

60 lines
1.6 KiB
Makefile
Raw Normal View History

2024-04-30 18:17:17 +02:00
.POSIX:
.SUFFIXES:
CC = cc
VERSION = 1.0
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-09-18 09:33:51 +02:00
username ?= default
2024-04-30 18:17:17 +02:00
# Flags
LDFLAGS = $(shell pkg-config --libs libsodium libnotify ncurses sqlite3)
CFLAGS = -O3 -mtune=native -march=native -pipe -g -std=c99 -Wno-pointer-sign -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 $(shell pkg-config --cflags libsodium libnotify ncurses sqlite3) -lpthread
2024-04-30 18:17:17 +02:00
2024-09-24 14:54:28 +02:00
SERVERSRC = src/zmr/*.c
CLIENTSRC = src/zen/*.c
LIBSRC = src/lib/*.c
2024-04-30 18:17:17 +02:00
INCLUDE = -Iinclude/
all: $(SERVER) $(CLIENT)
2024-04-30 18:17:17 +02:00
$(SERVER): $(SERVERSRC) $(LIBSRC)
mkdir -p bin
$(CC) $(SERVERSRC) $(LIBSRC) $(INCLUDE) -o bin/$@ $(CFLAGS) $(LDFLAGS)
2024-04-30 18:17:17 +02:00
$(CLIENT): $(CLIENTSRC) $(LIBSRC)
mkdir -p bin
2024-09-18 09:33:51 +02:00
$(CC) $(CLIENTSRC) $(LIBSRC) $(INCLUDE) -DUSERNAME=\"$(username)\" -o bin/$@-$(username) $(CFLAGS) $(LDFLAGS)
2024-04-30 18:17:17 +02:00
dist:
mkdir -p $(TARGET)-$(VERSION)
cp -R README.md $(MANPAGE) $(SERVER) $(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)
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:
$(RM) $(DESTDIR)$(BINDIR)/$(SERVER)
$(RM) $(DESTDIR)$(BINDIR)/$(CLIENT)
2024-04-30 18:17:17 +02:00
$(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean:
$(RM) $(SERVER) $(CLIENT)
2024-04-30 18:17:17 +02:00
.PHONY: all dist install uninstall clean