root/common/include/lib.mak.in @ 75a6426cd7c5474de6c0796132f99a80b0c38fff

Revision 75a6426cd7c5474de6c0796132f99a80b0c38fff, 1.6 KB (checked in by dsmith <dsmith@…>, 6 years ago)

Added DESTDIR variable to make system

git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@44 918edb2d-ff29-0410-9de2-eb38e7f22bc7

  • Property mode set to 100644
Line 
1#Copyright (C) 2007 L. Donnie Smith
2
3LDCONFIG = @LDCONFIG@
4
5HEADER     = $(LIB_NAME).h
6STATIC_LIB = lib$(LIB_NAME).a
7LINK_NAME  = lib$(LIB_NAME).so
8SO_NAME    = $(LINK_NAME).$(MAJOR_VER)
9SHARED_LIB = $(SO_NAME).$(MINOR_VER)
10DEST_INC_INST_DIR = $(DESTDIR)/$(INC_INST_DIR)
11DEST_LIB_INST_DIR = $(DESTDIR)/$(LIB_INST_DIR)
12
13OBJECTS = $(SOURCES:.c=.o)
14DEPS    = $(SOURCES:.c=.d)
15
16CFLAGS += -fpic
17
18all: static shared
19
20static: $(STATIC_LIB)
21
22shared: $(SHARED_LIB)
23
24$(STATIC_LIB): $(OBJECTS)
25        ar rcs $(STATIC_LIB) $(OBJECTS)
26
27$(SHARED_LIB): $(OBJECTS)
28        $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) $(LDLIBS) \
29              -o $(SHARED_LIB) $(OBJECTS)
30
31install: install_header install_static install_shared
32
33install_header: $(DEST_INC_INST_DIR)
34        install $(LIB_NAME).h $(DEST_INC_INST_DIR)
35
36$(DEST_INC_INST_DIR):
37        install -d $(DEST_INC_INST_DIR)
38
39install_static: static $(DEST_LIB_INST_DIR)
40        install $(STATIC_LIB) $(DEST_LIB_INST_DIR)
41
42install_shared: shared $(DEST_LIB_INST_DIR)
43        install $(SHARED_LIB) $(DEST_LIB_INST_DIR)
44        ln -sf $(SHARED_LIB) $(DEST_LIB_INST_DIR)/$(SO_NAME)
45        ln -sf $(SO_NAME) $(DEST_LIB_INST_DIR)/$(LINK_NAME)
46        $(LDCONFIG)
47
48$(DEST_LIB_INST_DIR):
49        install -d $(DEST_LIB_INST_DIR)
50
51clean:
52        rm -f $(STATIC_LIB) $(SHARED_LIB) $(OBJECTS) $(DEPS)
53
54uninstall:
55        rm -f $(DEST_INC_INST_DIR)/$(LIB_NAME).h \
56                $(DEST_LIB_INST_DIR)/$(STATIC_LIB) \
57                $(DEST_LIB_INST_DIR)/$(LINK_NAME)*
58
59ifneq ($(MAKECMDGOALS),clean)
60ifneq ($(MAKECMDGOALS),distclean)
61include $(COMMON)/include/dep.mak
62-include $(DEPS)
63endif
64endif
65
66.PHONY: all static shared install install_header install_static install_shared clean uninstall
Note: See TracBrowser for help on using the browser.