From 957fe3e8da428d312630f96bb435d80f787005d8 Mon Sep 17 00:00:00 2001 From: Elfyn McBratney Date: Fri, 12 Jan 2007 10:48:13 +0000 Subject: [PATCH] Tidy up a little; build static archive in addition to dynamic library. --- src/Makefile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Makefile b/src/Makefile index 17c8290..fb3e6ac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,25 +1,38 @@ +AR = ar CC = gcc +RANLIB = ranlib INC = -I. -CFLAGS = -g -Wall -fpic -fPIC $(INC) +ARFLAGS = cruv +CFLAGS = -g -Wall $(INC) LDFLAGS = -SOURCES = version.c -OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) +all_LIBS = liberuntime.a liberuntime.so + +common_SOURCES = version.c + +liberuntime_a_OBJECTS = $(patsubst %.c,%.static.o,$(common_SOURCES)) +liberuntime_so_OBJECTS = $(patsubst %.c,%.shared.o,$(common_SOURCES)) .PHONY: all -all: liberuntime.so +all: $(all_LIBS) -%.o: %.c +%.static.o: %.c $(CC) $(CFLAGS) -c $< -o $@ +%.shared.o: %.c + $(CC) $(CFLAGS) -fpic -fPIC -c $< -o $@ + +liberuntime.a: $(liberuntime_a_OBJECTS) + $(AR) $(ARFLAGS) $@ $^ + $(RANLIB) $@ -liberuntime.so: $(OBJECTS) +liberuntime.so: $(liberuntime_so_OBJECTS) $(CC) -shared -o $@ $^ $(LDFLAGS) .PHONY: clean clean: - -rm -f liberuntime.so $(OBJECTS) + -rm -f $(all_LIBS) $(liberuntime_a_OBJECTS) $(liberuntime_so_OBJECTS) -include Makefile.deps -- 2.11.4.GIT