diff options
author | Your Name <you@example.com> | 2022-02-18 20:35:38 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2022-02-18 20:35:38 -0500 |
commit | 55d58a16e2511741cc625e203205dec86144faf3 (patch) | |
tree | 311be7e5fbaf1bc8ece47dd4261af053f2da1c7c /Makefile | |
parent | aa9dabdeaead3c8b1b11f9d4f321265c439bfbfc (diff) | |
download | libbible-55d58a16e2511741cc625e203205dec86144faf3.tar.gz libbible-55d58a16e2511741cc625e203205dec86144faf3.tar.bz2 libbible-55d58a16e2511741cc625e203205dec86144faf3.zip |
Reorganized repository layout
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 58 |
1 files changed, 25 insertions, 33 deletions
@@ -1,44 +1,36 @@ -CC=g++ -LIBS=sword minizip -CFLAGS=-c -Wall -fPIC -std=c++20 -LDLIBS=-lstdc++fs -SOURCES=libbible.cc mods.cc settings.cc -OBJECTS=$(SOURCES:.cc=.o) -LIBRARY=libbible.so -EXECUTABLE=bible -ifeq ($(PREFIX),) - PREFIX := /usr -endif +LIBS = sword minizip +override CXXFLAGS += -MMD -Wall -fPIC -std=c++20 `pkg-config $(LIBS) --cflags` +override LDFLAGS += -lstdc++fs `pkg-config $(LIBS) --libs` +SOURCES = $(wildcard src/*.cc) $(wildcard src/lib/*.cc) +OBJECTS = $(SOURCES:.cc=.o) +DEPS = $(OBJECTS:.o=.d) +EXECUTABLE = bible +LIBRARY = libbible.so +PREFIX := /usr -all: $(SOURCES) $(LIBRARY) $(EXECUTABLE) +$(EXECUTABLE): $(OBJECTS) + $(CXX) $(OBJECTS) -o $@ $(LDFLAGS) + +-include $(DEPS) + +$(LIBRARY): $(OBJECTS) + $(CXX) $(OBJECTS) -shared -o $@ $(LDFLAGS) + +.PHONY: test +test: $(LIBRARY) + $(MAKE) -C src/test/ test install: $(LIBRARY) $(EXECUTABLE) install -d $(DESTDIR)$(PREFIX)/lib/ install -m 644 $(LIBRARY) $(DESTDIR)$(PREFIX)/lib/ install -d $(DESTDIR)$(PREFIX)/include/ - install -m 644 libbible.h $(DESTDIR)$(PREFIX)/include/ + install -m 644 src/lib/libbible.h $(DESTDIR)$(PREFIX)/include/ install -d $(DESTDIR)$(PREFIX)/bin/ - install -m 755 bible $(DESTDIR)$(PREFIX)/bin/ + install -m 755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/ install -d $(DESTDIR)`pkg-config --variable=completionsdir bash-completion` install -m 644 bible.bash $(DESTDIR)`pkg-config --variable=completionsdir bash-completion`/$(EXECUTABLE) -test: $(OBJECTS) testLibbible.o - $(CC) $(OBJECTS) testLibbible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` -lcppunit - -testLibbible.o: testLibbible.cc - $(CC) $(CFLAGS) testLibbible.cc -o $@ - -bible: $(OBJECTS) bible.o - $(CC) $(OBJECTS) bible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` $(LDLIBS) - -bible.o: bible.cc - $(CC) $(CFLAGS) bible.cc -o $@ - -$(LIBRARY): $(OBJECTS) - $(CC) $(OBJECTS) -shared -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` $(LDLIBS) - -.cc.o: - $(CC) $(CFLAGS) $< -o $@ `pkg-config $(LIBS) --cflags` - +.PHONY: clean clean: - rm -rf *.o $(LIBRARY) test bible + $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE) $(LIBRARY) $(TEST) + $(MAKE) -C src/test/ clean |