]> git.stg.codes - stg.git/blob - stglibs/Makefile.in
Keep stglibs headers and libraries "at home"
[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).a
8
9 SEARCH_DIRS = -I $(DIR_INCLUDE) -I . -I ./include
10
11 ifeq ($(STG_TIME), yes)
12 DEFS += -DSTG_TIME
13 endif
14
15 ifneq ($(LIB_DEFS),)
16 DEFS += $(LIB_DEFS)
17 endif
18
19 ifneq ($(LIB_INCS),)
20 SEARCH_DIRS += $(LIB_INCS)
21 endif
22
23 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
24
25 #INST_INCS = $(addprefix $(DIR_INCLUDE)/, $(notdir $(INCS)))
26 #INST_LIBS = $(DIR_LIB)/lib$(LIB_NAME)
27
28 CXXFLAGS += -fPIC
29 CFLAGS += -fPIC
30
31 vpath %.a $(DIR_LIB)
32
33 all: $(PROG)
34
35 $(PROG): $(OBJS) $(STGLIBS)
36         ar rc lib$(LIB_NAME).a $(OBJS)
37         ranlib lib$(LIB_NAME).a
38         #cp *.a $(DIR_LIB)
39
40 #includes: $(INCS)
41 #       cp -p $(INCS) $(DIR_INCLUDE)/stg
42
43 clean:
44         rm -f deps $(PROG) *.o *.a *.so tags *.*~ 
45         #for file in $(INCS); do \
46         #    rm -f $(DIR_INCLUDE)/stg/$$file; \
47         #done
48
49 install: $(PROG)
50         mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/lib/stg
51         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/stg/$(PROG)
52         mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/include/stg
53         install -m $(DATA_MODE) -o $(OWNER) $(INCS) $(PREFIX)/usr/include/stg/
54
55 uninstall:
56         rm -f $(PREFIX)/usr/lib/stg/$(PROG)
57         for file in $(INCS); do \
58             rm -f $(PREFIX)/usr/include/stg/$$file; \
59         done
60
61 ifneq ($(MAKECMDGOALS),includes)
62 ifneq ($(MAKECMDGOALS),clean)
63 ifneq ($(MAKECMDGOALS),uninstall)
64 -include deps
65 endif
66 endif
67 endif
68
69 deps:   $(SRCS) ../../Makefile.conf
70         @>deps ;\
71         for file in $(SRCS); do\
72           echo "$$file" | grep ".c$$" > /dev/null;\
73           if [ $$? == 0 ];\
74           then\
75             echo "`$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
76             echo -e '\t$$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\
77           else\
78             echo "`$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
79             echo -e '\t$$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\
80           fi;\
81         done
82