File: lib.mak.in

package info (click to toggle)
cwiid 0.6.00%2Bsvn201-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,372 kB
  • sloc: ansic: 7,572; makefile: 281; python: 255; lex: 176; yacc: 73; awk: 16
file content (60 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#Copyright (C) 2007 L. Donnie Smith

LDCONFIG = @LDCONFIG@

HEADER	   = $(LIB_NAME).h
STATIC_LIB = lib$(LIB_NAME).a
LINK_NAME  = lib$(LIB_NAME).so
SO_NAME    = $(LINK_NAME).$(MAJOR_VER)
SHARED_LIB = $(SO_NAME).$(MINOR_VER)
DEST_INC_INST_DIR = $(ROOTDIR)$(INC_INST_DIR)
DEST_LIB_INST_DIR = $(ROOTDIR)$(LIB_INST_DIR)

OBJECTS = $(SOURCES:.c=.o)
DEPS    = $(SOURCES:.c=.d)

CFLAGS += -fpic

all: static shared

static: $(STATIC_LIB)

shared: $(SHARED_LIB)

$(STATIC_LIB): $(OBJECTS)
	ar rcs $(STATIC_LIB) $(OBJECTS)

$(SHARED_LIB): $(OBJECTS)
	$(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) \
	      -o $(SHARED_LIB) $(OBJECTS) $(LDLIBS)

install: install_header install_static install_shared

install_header:
	install -D $(LIB_NAME).h $(DEST_INC_INST_DIR)/$(LIB_NAME).h

install_static: static
	install -D $(STATIC_LIB) $(DEST_LIB_INST_DIR)/$(STATIC_LIB)

install_shared: shared
	install -D $(SHARED_LIB) $(DEST_LIB_INST_DIR)/$(SHARED_LIB)
	ln -sf $(SHARED_LIB) $(DEST_LIB_INST_DIR)/$(SO_NAME)
	ln -sf $(SO_NAME) $(DEST_LIB_INST_DIR)/$(LINK_NAME)
	$(LDCONFIG)

clean:
	rm -f $(STATIC_LIB) $(SHARED_LIB) $(OBJECTS) $(DEPS)

uninstall:
	rm -f $(DEST_INC_INST_DIR)/$(LIB_NAME).h \
		$(DEST_LIB_INST_DIR)/$(STATIC_LIB) \
		$(DEST_LIB_INST_DIR)/$(LINK_NAME)*

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
include $(COMMON)/include/dep.mak
-include $(DEPS)
endif
endif

.PHONY: all static shared install install_header install_static install_shared clean uninstall