source: trunk/src/libsrc/util/libmseed/makefile.unix @ 7953

Revision 7953, 1.8 KB checked in by baker, 3 months ago (diff)

fix target prerequisites to be more accurate, elminates unnecessary rebuilds

Line 
1
2# This libmseed Makefile is modified for Earthworm
3
4# Build environment can be configured the following
5# environment variables:
6#   CC : Specify the C compiler to use
7#   GLOBALFLAGS : Specify compiler options to use
8
9CFLAGS = $(GLOBALFLAGS)
10
11MAJOR_VER = 2
12MINOR_VER = 13
13CURRENT_VER = $(MAJOR_VER).$(MINOR_VER)
14COMPAT_VER = $(MAJOR_VER).$(MINOR_VER)
15
16LIB_SRCS = fileutils.c genutils.c gswap.c lmplatform.c lookup.c \
17           msrutils.c pack.c packdata.c traceutils.c tracelist.c \
18           parseutils.c unpack.c unpackdata.c selection.c logging.c
19
20LIB_OBJS = $(LIB_SRCS:.c=.o)
21LIB_DOBJS = $(LIB_SRCS:.c=.lo)
22
23LIB_A = libmseed.a
24LIB_SO = libmseed.so.$(CURRENT_VER)
25LIB_SO_ALIAS = libmseed.so
26LIB_DYN = libmseed.$(CURRENT_VER).dylib
27LIB_DYN_ALIAS = libmseed.dylib
28
29all: static
30
31static: $(LIB_A)
32
33shared: $(LIB_SO)
34
35dynamic: $(LIB_DYN)
36
37# Build static library
38$(LIB_A): $(LIB_OBJS)
39        $(RM) $(LIB_A)
40        ar -crs $(LIB_A) $(LIB_OBJS)
41
42# Build shared library using GCC-style options
43$(LIB_SO): $(LIB_DOBJS)
44        $(RM) $(LIB_SO) $(LIB_SO_ALIAS)
45        $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,$(LIB_SO_ALIAS) -o $(LIB_SO) $(LIB_DOBJS)
46        ln -s $(LIB_SO) $(LIB_SO_ALIAS)
47
48# Build dynamic library (usually for Mac OSX)
49$(LIB_DYN): $(LIB_DOBJS)
50        $(RM) $(LIB_DYN) $(LIB_DYN_ALIAS)
51        $(CC) $(CFLAGS) -dynamiclib -compatibility_version $(COMPAT_VER) -current_version $(CURRENT_VER) -install_name $(LIB_DYN_ALIAS) -o $(LIB_DYN) $(LIB_DOBJS)
52        ln -sf $(LIB_DYN) $(LIB_DYN_ALIAS)
53
54clean:
55        -$(RM) $(LIB_OBJS) $(LIB_DOBJS) $(LIB_A) $(LIB_SO) $(LIB_SO_ALIAS) $(LIB_DYN) $(LIB_DYN_ALIAS)
56
57install: $(EW_HOME)/$(EW_VERSION)/lib/libmseed.a
58
59$(EW_HOME)/$(EW_VERSION)/lib/libmseed.a: libmseed.a
60        cp $< $@
61
62
63.SUFFIXES: .c .o .lo
64
65# Standard object building
66.c.o:
67        $(CC) $(CFLAGS) -c $< -o $@
68
69# Standard object building for dynamic library components using -fPIC
70.c.lo:
71        $(CC) $(CFLAGS) -fPIC -c $< -o $@
Note: See TracBrowser for help on using the repository browser.