]> git.stg.codes - stg.git/blob - stglibs/Makefile.in
Добавление исходников
[stg.git] / stglibs / Makefile.in
1 ###############################################################################
2 # $Id: Makefile.in,v 1.28 2009/03/03 15:50:14 faust Exp $
3 ###############################################################################
4
5 include ../../Makefile.conf
6
7 PROG = lib$(LIB_NAME).so
8
9 ifeq ($(PROT), on)
10 DEFS += -DLINPROT
11 endif
12
13 ifeq ($(DEMO), on)
14 DEFS += -DDEMO
15 endif
16
17 ifeq ($(OS), bsd)
18     ifeq ($(PROT), on)
19     DEFS += -DFREEBDSPROT
20     endif
21 MAKE = gmake
22 endif
23
24 ifeq ($(OS), bsd5)
25     ifeq ($(PROT), on)
26     DEFS += -DFREEBDSPROT
27     endif
28 MAKE = gmake
29 endif
30
31 ifeq ($(STG_TIME), yes)
32 DEFS += -DSTG_TIME
33 endif
34
35 ifneq ($(ADD_DEFS_1),)
36 DEFS += $(ADD_DEFS_1)
37 endif
38
39 SEARCH_DIRS = -I $(DIR_INCLUDE) -I ./
40
41 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
42
43 INST_INCS = $(addprefix $(DIR_INCLUDE)/, $(notdir $(INCS)))
44 INST_LIBS = $(DIR_LIB)/lib$(LIB_NAME)
45
46 CXXFLAGS += -fPIC
47 LDFLAGS += -shared -Wl,-rpath,$(PREFIX)/usr/lib/stg
48
49 ifneq ($(ADD_CXXFLAGS_1),)
50 CXXFLAGS += $(ADD_CXXFLAGS_1)
51 endif
52
53 vpath %.so $(DIR_LIB)
54
55 all: $(PROG)
56
57 $(PROG): $(OBJS) $(STGLIBS)
58         g++ $(LDFLAGS) -Wl,-soname,$(PROG) $^ $(LIBS) -o $(PROG) -L $(DIR_LIB) 
59         ar rc lib$(LIB_NAME).a $(OBJS)
60         ranlib lib$(LIB_NAME).a
61         cp *.so $(DIR_LIB)
62         cp *.a $(DIR_LIB)
63
64 includes: $(INCS)
65         cp -p $(INCS) $(DIR_INCLUDE)
66
67 clean:
68         rm -f deps $(PROG) *.o *.a *.so tags *.*~ 
69         for file in $(INCS); do \
70             rm -f $(DIR_INCLUDE)/$$file; \
71         done
72
73 install: $(PROG)
74         mkdir -m $(BIN_MODE) -p $(PREFIX)/usr/lib/stg
75         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/stg/$(PROG)
76
77 uninstall:
78         rm -f $(PREFIX)/usr/lib/stg/$(PROG)
79
80 ifneq ($(MAKECMDGOALS),includes)
81 ifneq ($(MAKECMDGOALS),clean)
82 ifneq ($(MAKECMDGOALS),uninstall)
83 -include deps
84 endif
85 endif
86 endif
87
88 deps:   $(SRCS) ../../Makefile.conf
89         @>deps ;\
90         for file in $(SRCS); do\
91           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -MM -MG $$file` Makefile ../../Makefile.conf" >> deps ;\
92           echo -e '\t$$(CC) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\
93         done
94