Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Turning libupskirt into a full-fledged dynamic library

  • Loading branch information...
commit 7d90e98beecda446490f515d6cdc07395b8c07af 1 parent 234de1a
Natacha Porté authored
Showing with 38 additions and 13 deletions.
  1. +20 −7 BSDmakefile
  2. +18 −6 GNUmakefile
View
27 BSDmakefile
@@ -16,29 +16,42 @@
DEPDIR=depends
ALLDEPS=$(DEPDIR)/all
-CFLAGS=-c -g -O3 -Wall -Werror
+CFLAGS=-c -g -O3 -Wall -Werror -fPIC
LDFLAGS=-g -O3 -Wall -Werror
CC=gcc
-all: lace kilt
+all: libupskirt.so lace kilt
.PHONY: all clean
-# Main project links
+# libraries
-lace: lace.o markdown.o array.o buffer.o renderers.o
+libupskirt.so: libupskirt.so.1
+ ln -s $(.ALLSRC) $(.TARGET)
+
+libupskirt.so.1: markdown.o array.o buffer.o renderers.o
+ $(CC) $(LDFLAGS) -shared -Wl,-soname=$(.TARGET) \
+ $(.ALLSRC) -o $(.TARGET)
+
+
+# executables
+
+lace: lace.o libupskirt.so
$(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
-benchmark: benchmark.o markdown.o array.o buffer.o renderers.o
+kilt: kilt.o libupskirt.so
$(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
-kilt: kilt.o markdown.o array.o buffer.o
+
+# Housekeeping
+
+benchmark: benchmark.o libupskirt.so
$(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
clean:
rm -f *.o
- rm -f lace kilt benchmark
+ rm -f libupskirt.so libupskirt.so.1 lace kilt benchmark
rm -rf $(DEPDIR)
View
24 GNUmakefile
@@ -19,25 +19,37 @@ CFLAGS=-c -g -O3 -Wall -Werror
LDFLAGS=-g -O3 -Wall -Werror
CC=gcc
-all: lace kilt
+all: libupskirt.so lace kilt
.PHONY: all clean
-# Main project links
+# libraries
-lace: lace.o markdown.o array.o buffer.o renderers.o
+libupskirt.so: libupskirt.so.1
+ ln -s $^ $@
+
+libupskirt.so.1: markdown.o array.o buffer.o renderers.o
+ $(CC) $(LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
+
+
+# executables
+
+lace: lace.o libupskirt.so
$(CC) $(LDFLAGS) $^ -o $@
-benchmark: benchmark.o markdown.o array.o buffer.o renderers.o
+kilt: kilt.o libupskirt.so
$(CC) $(LDFLAGS) $^ -o $@
-kilt: kilt.o markdown.o array.o buffer.o
+
+# housekeeping
+
+benchmark: benchmark.o libupskirt.so
$(CC) $(LDFLAGS) $^ -o $@
clean:
rm -f *.o
- rm -f lace kilt benchmark
+ rm -f libupskirt.so libupskirt.so.1 lace kilt benchmark
rm -rf $(DEPDIR)
Please sign in to comment.
Something went wrong with that request. Please try again.