summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Torres <devin@devintorr.es>2015-05-26 14:31:12 -0500
committerDevin Torres <devin@devintorr.es>2015-05-26 14:31:12 -0500
commitdc5273288c82cff1d8ca407e4a12a4249019d924 (patch)
tree4380e092ae3199fd15a789804fe8673f2ad9c0bb
parent7c7aadf91dcfb71307d38a9cbbf7726fd5a63c91 (diff)
parentbe82ac2cb0cb4a8695f6baebadb0e3e7f5b87b10 (diff)
downloadrust-hoedown-dc5273288c82cff1d8ca407e4a12a4249019d924.tar.gz
Merge pull request #160 from cuviper/makefile-overrides
tweak the Makefile for better distro support
-rw-r--r--.gitignore1
-rw-r--r--Makefile35
2 files changed, 22 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index e885c6c..b8a9371 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 e777801..75c3e26 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,12 @@
-CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc
+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)
- CFLAGS += -fPIC
+ HOEDOWN_CFLAGS += -fPIC
endif
HOEDOWN_SRC=\
@@ -18,7 +22,7 @@ HOEDOWN_SRC=\
.PHONY: all test test-pl clean
-all: libhoedown.so hoedown smartypants
+all: libhoedown.so libhoedown.a hoedown smartypants
# Libraries
@@ -26,7 +30,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 $^
@@ -63,21 +67,24 @@ 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
%.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 $@ $<