From 4f26d55e01f9424ba5660cb27076eafba4c88b21 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 19 Feb 2022 10:54:35 -0500 Subject: Reorganized sources --- Makefile | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 496aac6..9c9eb08 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,29 @@ -CC=g++ LIBS=gtkmm-3.0 -CFLAGS=-c -Wall -LDLIBS=-pthread -lbible -SOURCES=header.cc main.cc mods.cc readerview.cc sword.cc +override CXXFLAGS += -MMD -Wall `pkg-config $(LIBS) --cflags` +override LDFLAGS += -pthread -lbible `pkg-config $(LIBS) --libs` +SOURCES=$(wildcard src/*.cc) OBJECTS=$(SOURCES:.cc=.o) +DEPS = $(OBJECTS:.o=.d) EXECUTABLE=biblereader -ifeq ($(PREFIX),) - PREFIX := /usr -endif +PREFIX ?= /usr +EXEC_PREFIX ?= $(PREFIX) +BINDIR ?= $(EXEC_PREFIX)/bin -all: $(SOURCES) $(EXECUTABLE) +$(EXECUTABLE): $(OBJECTS) + $(CXX) $(OBJECTS) -o $@ $(LDFLAGS) + +-include $(DEPS) install: $(EXECUTABLE) - install -d $(DESTDIR)$(PREFIX)/bin/ - install -m 755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/ + install -d $(DESTDIR)$(BINDIR) + install -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR) install -d $(DESTDIR)$(PREFIX)/share/applications/ - install -m 644 biblereader.desktop $(DESTDIR)$(PREFIX)/share/applications/ + install -m 644 files/biblereader.desktop $(DESTDIR)$(PREFIX)/share/applications/ install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ - install -m 644 biblereader_128.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/biblereader.png + install -m 644 files/biblereader_128.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/biblereader.png install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/ - install -m 644 biblereader_64.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/biblereader.png - -$(EXECUTABLE): $(OBJECTS) - $(CC) $(OBJECTS) -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` $(LDLIBS) - -.cc.o: - $(CC) $(CFLAGS) $< -o $@ `pkg-config $(LIBS) --cflags` + install -m 644 files/biblereader_64.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/biblereader.png +.PHONY: clean clean: - rm -rf *.o $(EXECUTABLE) + $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE) -- cgit v1.2.3