From ed16442fb72dadaac18c0d8ade509a9c8fc89746 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Mon, 23 Nov 2009 23:32:06 -0500 Subject: Use a static library instead of a dynamic one A dynamic library will cause pain to users when they find that the tool can not find the library. For now, just use a static library to make the use of the tool more convenient. Signed-off-by: Steven Rostedt --- Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1c042e0..7472c11 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ CC = gcc +AR = ar EXT = -std=gnu99 CFLAGS = -g -Wall # -O2 INCLUDES = -I. -I/usr/local/include @@ -8,15 +9,17 @@ LIBS = -L. -lparsevent %.o: %.c $(CC) -c $(CFLAGS) $(EXT) $(INCLUDES) $< -o $@ -TARGETS = libparsevent.so trace-cmd +TARGETS = libparsevent.a trace-cmd all: $(TARGETS) +LIB_FILE = libparsevent.a + trace-read.o:: parse-events.h -trace-cmd.o:: parse-events.h +trace-cmd.o:: parse-events.h $(LIB_FILE) trace-cmd:: trace-cmd.o trace-read.o - $(CC) $^ -o $@ $(LIBS) + $(CC) $^ $(LIBS) -o $@ parse-events.o: parse-events.c parse-events.h $(CC) -c $(CFLAGS) $(EXT) $(INCLUDES) -fPIC $< -o $@ @@ -24,9 +27,14 @@ parse-events.o: parse-events.c parse-events.h trace-seq.o: trace-seq.c parse-events.h $(CC) -c $(CFLAGS) $(EXT) $(INCLUDES) -fPIC $< -o $@ -libparsevent.so: parse-events.o trace-seq.o +LIB_OBJS = parse-events.o trace-seq.o + +libparsevent.so: $(LIB_OBJS) $(CC) --shared $^ -o $@ +libparsevent.a: $(LIB_OBJS) + $(RM) $@; $(AR) rcs $@ $^ + .PHONY: force force: @@ -34,4 +42,4 @@ TAGS: force find . -name '*.[ch]' | xargs etags clean: - $(RM) *.o *~ $(TARGETS) + $(RM) *.o *~ $(TARGETS) *.a *.so -- cgit v1.2.2