]> git.stg.codes - stg.git/blob - stglibs/Makefile.in
Fix installing libraries
[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 ../../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 CXXFLAGS += -fPIC $(SEARCH_DIRS) $(DEFS)
26 CFLAGS += -fPIC $(SEARCH_DIRS) $(DEFS)
27
28 all: $(PROG)
29
30 $(PROG): $(OBJS)
31         ar rc lib$(LIB_NAME).a $(OBJS)
32         ranlib lib$(LIB_NAME).a
33
34 clean:
35         rm -f deps $(PROG) *.o *.a *.so tags *.*~ 
36
37 install: $(PROG)
38         mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/lib/stg
39         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/stg/$(PROG)
40         mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/include/stg
41         install -m $(DATA_MODE) -o $(OWNER) $(addprefix include/stg/,$(INCS)) $(PREFIX)/usr/include/stg/
42
43 uninstall:
44         rm -f $(PREFIX)/usr/lib/stg/$(PROG)
45         for file in $(INCS); do \
46             rm -f $(PREFIX)/usr/include/stg/$$file; \
47         done
48
49 ifneq ($(MAKECMDGOALS),includes)
50 ifneq ($(MAKECMDGOALS),clean)
51 ifneq ($(MAKECMDGOALS),uninstall)
52 -include deps
53 endif
54 endif
55 endif
56
57 deps:   $(SRCS) ../../Makefile.conf
58         @>deps ;\
59         for file in $(SRCS); do\
60           echo "$$file" | grep ".c$$" > /dev/null;\
61           if [ $$? == 0 ];\
62           then\
63             echo "`$(CC) $(CFLAGS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
64             echo -e '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
65           else\
66             echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
67             echo -e '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\
68           fi;\
69         done