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)
29 SEARCH_DIRS = -I ../../include
32 SEARCH_DIRS += -I/usr/local/include
33 CXXFLAGS += -DHAVE_DECL_GETOPT=1
37 SEARCH_DIRS += -I/usr/local/include
38 CXXFLAGS += -DHAVE_DECL_GETOPT=1
41 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
43 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
44 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
45 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
47 .PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data
48 all: libs $(PROG) ../../Makefile.conf
51 $(MAKE) -C $(DIR_LIBSRC)
54 $(CXX) $^ $(LIBS) $(LDFLAGS) -o $(PROG)
57 rm -f deps $(PROG) *.o tags *.*~ .OS
62 $(MAKE) -C $(DIR_LIBSRC) clean
65 rm -f ../../Makefile.conf
67 install: install-bin install-data
71 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/bin
72 install -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/bin/$(PROG)
74 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/bin
75 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/bin/$(PROG)
77 $(MAKE) -C $(DIR_LIBSRC) install
79 uninstall: uninstall-bin uninstall-data
82 rm -f $(PREFIX)/usr/sbin/$(PROG)
85 ifneq ($(MAKECMDGOALS),distclean)
86 ifneq ($(MAKECMDGOALS),clean)
87 ifneq ($(MAKECMDGOALS),uninstall)
93 deps: $(SRCS) ../../Makefile.conf
94 $(MAKE) -C $(DIR_LIBSRC)
96 for file in $(SRCS); do\
97 echo "$$file" | grep ".c$$" > /dev/null;\
100 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
101 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
103 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
104 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\