1 ###############################################################################
2 # $Id: Makefile,v 1.3 2008/05/11 09:30:43 nobunaga Exp $
3 ###############################################################################
5 include ../../Makefile.conf
17 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
18 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
20 LIBS += $(addprefix -lstg,$(STGLIBS)) -lexpat $(LIB_THREAD)
28 SEARCH_DIRS = -I ../../include
31 SEARCH_DIRS += -I/usr/local/include
32 CXXFLAGS += -DHAVE_DECL_GETOPT=1
36 SEARCH_DIRS += -I/usr/local/include
37 CXXFLAGS += -DHAVE_DECL_GETOPT=1
40 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
42 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
43 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
44 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
46 .PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data
47 all: libs $(PROG) ../../Makefile.conf
50 $(MAKE) -C $(DIR_LIBSRC)
53 $(CXX) $^ $(LIBS) $(LDFLAGS) -o $(PROG)
56 rm -f deps $(PROG) *.o tags *.*~ .OS
61 $(MAKE) -C $(DIR_LIBSRC) clean
64 rm -f ../../Makefile.conf
66 install: install-bin install-data
70 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/bin
71 install -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/bin/$(PROG)
73 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/bin
74 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/bin/$(PROG)
76 $(MAKE) -C $(DIR_LIBSRC) install
78 uninstall: uninstall-bin uninstall-data
81 rm -f $(PREFIX)/usr/sbin/$(PROG)
84 ifneq ($(MAKECMDGOALS),distclean)
85 ifneq ($(MAKECMDGOALS),clean)
86 ifneq ($(MAKECMDGOALS),uninstall)
92 deps: $(SRCS) ../../Makefile.conf
93 $(MAKE) -C $(DIR_LIBSRC)
95 for file in $(SRCS); do\
96 echo "$$file" | grep ".c$$" > /dev/null;\
99 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
100 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
102 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
103 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\