From 0c8eb03f10c04cf2430d60e4bd32711c37dae850 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2015 11:57:50 -0700 Subject: [PATCH 1/4] Set an SONAME for libhoedown.so.3 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e7778011..62ec80a9 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ libhoedown.so: libhoedown.so.3 ln -f -s $^ $@ libhoedown.so.3: $(HOEDOWN_SRC) - $(CC) -shared $^ $(LDFLAGS) -o $@ + $(CC) -Wl,-soname,$(@F) -shared $^ $(LDFLAGS) -o $@ libhoedown.a: $(HOEDOWN_SRC) $(AR) rcs libhoedown.a $^ From ede482b2a6e12a6596a3b14c78babffa715b3a6a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2015 11:58:49 -0700 Subject: [PATCH 2/4] Include libhoedown.a in "make all" --- .gitignore | 1 + Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e885c6c8..b8a9371d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ hoedown.exp hoedown.lib smartypants libhoedown.so* +libhoedown.a diff --git a/Makefile b/Makefile index 62ec80a9..497b67ce 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ HOEDOWN_SRC=\ .PHONY: all test test-pl clean -all: libhoedown.so hoedown smartypants +all: libhoedown.so libhoedown.a hoedown smartypants # Libraries From 4e38dcab448f054d82a346e3c9d21ac78516a416 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2015 12:01:48 -0700 Subject: [PATCH 3/4] Support command-line override of CFLAGS Most of the CFLAGS options can reasonably be changed at will, but a few are necessary. Move those few into HOEDOWN_CFLAGS, so the rest can be overridden, e.g. by distro policy. --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 497b67ce..e77613a3 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ -CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc +CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter PREFIX = /usr/local +HOEDOWN_CFLAGS = $(CFLAGS) -Isrc ifneq ($(OS),Windows_NT) - CFLAGS += -fPIC + HOEDOWN_CFLAGS += -fPIC endif HOEDOWN_SRC=\ @@ -77,7 +78,7 @@ install: # Generic object compilations %.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(HOEDOWN_CFLAGS) -c -o $@ $< src/html_blocks.o: src/html_blocks.c - $(CC) $(CFLAGS) -Wno-static-in-inline -c -o $@ $< + $(CC) $(HOEDOWN_CFLAGS) -Wno-static-in-inline -c -o $@ $< From be82ac2cb0cb4a8695f6baebadb0e3e7f5b87b10 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2015 12:06:38 -0700 Subject: [PATCH 4/4] Support overrides for bin, lib, and include Usually bin and include are the same, but for instance lib may want to be lib64 on Red Hat distros. Add BINDIR, LIBDIR, and INCLUDEDIR variables that can be overridden on the command line. This commit also tweaks the way the libraries are installed, dropping execute privileges on libhoedown.a, and making sure libhoedown.so is installed as a symlink. (The install command doesn't preserve symlinks.) --- Makefile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e77613a3..75c3e26a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +LIBDIR = $(PREFIX)/lib +INCLUDEDIR = $(PREFIX)/include HOEDOWN_CFLAGS = $(CFLAGS) -Isrc ifneq ($(OS),Windows_NT) @@ -64,16 +67,19 @@ clean: # Installing install: - install -m755 -d $(DESTDIR)$(PREFIX)/lib - install -m755 -d $(DESTDIR)$(PREFIX)/bin - install -m755 -d $(DESTDIR)$(PREFIX)/include + install -m755 -d $(DESTDIR)$(LIBDIR) + install -m755 -d $(DESTDIR)$(BINDIR) + install -m755 -d $(DESTDIR)$(INCLUDEDIR) - install -m644 libhoedown.* $(DESTDIR)$(PREFIX)/lib - install -m755 hoedown $(DESTDIR)$(PREFIX)/bin - install -m755 smartypants $(DESTDIR)$(PREFIX)/bin + install -m644 libhoedown.a $(DESTDIR)$(LIBDIR) + install -m755 libhoedown.so.3 $(DESTDIR)$(LIBDIR) + ln -f -s libhoedown.so.3 $(DESTDIR)$(LIBDIR)/libhoedown.so - install -m755 -d $(DESTDIR)$(PREFIX)/include/hoedown - install -m644 src/*.h $(DESTDIR)$(PREFIX)/include/hoedown + install -m755 hoedown $(DESTDIR)$(BINDIR) + install -m755 smartypants $(DESTDIR)$(BINDIR) + + install -m755 -d $(DESTDIR)$(INCLUDEDIR)/hoedown + install -m644 src/*.h $(DESTDIR)$(INCLUDEDIR)/hoedown # Generic object compilations