2018-12-15 04:37:57 +00:00
|
|
|
SRCDIR = src
|
2021-04-19 18:33:44 +00:00
|
|
|
LIBDIR = dmd_core
|
2018-12-15 04:37:57 +00:00
|
|
|
CC = gcc
|
2021-04-19 18:33:44 +00:00
|
|
|
GIT = git
|
|
|
|
CARGO = cargo
|
2019-01-01 01:50:45 +00:00
|
|
|
CFLAGS = $(shell pkg-config --cflags gtk+-3.0) -Wall -std=gnu99
|
2018-12-15 04:57:06 +00:00
|
|
|
GTKLIBS = $(shell pkg-config --libs gtk+-3.0)
|
2018-12-19 23:21:21 +00:00
|
|
|
EXE = dmd5620
|
2018-12-15 04:37:57 +00:00
|
|
|
CSRC = $(wildcard src/*.c)
|
|
|
|
OBJ = $(CSRC:.c=.o)
|
2021-04-13 01:38:45 +00:00
|
|
|
LDFLAGS = $(GTKLIBS) -lm -lpthread -lc -ldl -lutil
|
2021-04-19 18:33:44 +00:00
|
|
|
CORELIB = $(LIBDIR)/target/release/libdmd_core.a
|
2018-12-30 02:56:42 +00:00
|
|
|
|
|
|
|
ifeq ($(PREFIX),)
|
|
|
|
PREFIX := /usr/local
|
|
|
|
endif
|
2018-12-15 04:37:57 +00:00
|
|
|
|
2018-12-18 06:04:07 +00:00
|
|
|
ifdef DEBUG
|
2022-09-02 21:57:50 +00:00
|
|
|
CFLAGS+ = -g -O0
|
2018-12-18 06:04:07 +00:00
|
|
|
else
|
2022-09-02 21:57:50 +00:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
CFLAGS += -O3 -Os
|
|
|
|
else
|
|
|
|
CFLAGS += -O3 -Os -s
|
|
|
|
endif
|
2018-12-18 06:04:07 +00:00
|
|
|
endif
|
|
|
|
|
2018-12-15 04:37:57 +00:00
|
|
|
.PHONY: all clean
|
|
|
|
|
|
|
|
all: $(EXE)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -f $(EXE) $(OBJ)
|
2021-04-19 18:33:44 +00:00
|
|
|
@cd $(LIBDIR) && $(CARGO) clean
|
2018-12-15 04:57:06 +00:00
|
|
|
|
2021-04-19 18:33:44 +00:00
|
|
|
$(CORELIB):
|
2022-09-10 19:00:37 +00:00
|
|
|
$(if $(wildcard ./dmd_core/Cargo.toml),,$(error The submodule dmd_core is not checked out.))
|
|
|
|
@cd $(LIBDIR) && $(CARGO) build --release
|
2021-04-19 18:33:44 +00:00
|
|
|
|
2022-09-10 19:00:37 +00:00
|
|
|
$(EXE): $(CORELIB) $(OBJ)
|
|
|
|
@$(CC) $(CFLAGS) -o $@ $^ $(CORELIB) $(LDFLAGS)
|
2018-12-30 02:56:42 +00:00
|
|
|
|
|
|
|
install: $(EXE)
|
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install -m 755 $(EXE) $(DESTDIR)$(PREFIX)/bin
|
2021-04-13 01:38:45 +00:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/man/man1
|
|
|
|
install -m 644 dmd5620.man $(DESTDIR)$(PREFIX)/man/man1/dmd5620.1
|
2018-12-30 02:56:42 +00:00
|
|
|
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
|
|
|
|
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
|
|
|
|
install -m 644 assets/dmd5620.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
|
|
|
|
install -m 644 assets/dmd5620.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
|
2018-12-15 04:37:57 +00:00
|
|
|
|
2018-12-30 02:56:42 +00:00
|
|
|
uninstall:
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/$(EXE)
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/dmd5620.png
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/dmd5620.svg
|
2021-04-13 01:38:45 +00:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/man/man1/dmd5620.1
|