]> git.stg.codes - stg.git/blob - stglibs/Makefile.in
Fix stglibs Makefile to install headers into subdirectory
[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),)
36 DEFS += $(ADD_DEFS)
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 $(DEFS)
47 LDFLAGS += -shared -Wl,-rpath,$(PREFIX)/usr/lib/stg
48
49 vpath %.so $(DIR_LIB)
50
51 all: $(PROG)
52
53 $(PROG): $(OBJS) $(STGLIBS)
54         $(CXX) $(LDFLAGS) -Wl,-soname,$(PROG) $^ $(LIBS) -o $(PROG) -L $(DIR_LIB) 
55         ar rc lib$(LIB_NAME).a $(OBJS)
56         ranlib lib$(LIB_NAME).a
57         cp *.so $(DIR_LIB)
58         cp *.a $(DIR_LIB)
59
60 includes: $(INCS)
61         cp -p $(INCS) $(DIR_INCLUDE)/stg
62
63 clean:
64         rm -f deps $(PROG) *.o *.a *.so tags *.*~ 
65         for file in $(INCS); do \
66             rm -f $(DIR_INCLUDE)/$$file; \
67         done
68
69 install: $(PROG)
70         mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/lib/stg
71         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/stg/$(PROG)
72
73 uninstall:
74         rm -f $(PREFIX)/usr/lib/stg/$(PROG)
75
76 ifneq ($(MAKECMDGOALS),includes)
77 ifneq ($(MAKECMDGOALS),clean)
78 ifneq ($(MAKECMDGOALS),uninstall)
79 -include deps
80 endif
81 endif
82 endif
83
84 deps:   $(SRCS) ../../Makefile.conf
85         @>deps ;\
86         for file in $(SRCS); do\
87           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -MM -MG $$file` Makefile ../../Makefile.conf" >> deps ;\
88           echo -e '\t$$(CC) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\
89         done
90