PROG = sgconf
SRCS = ./main.cpp \
- ./common_sg.cpp
+ ./common_sg.cpp \
+ ./options.cpp \
+ ./actions.cpp
STGLIBS = conffiles \
srvconf \
- common \
- crypto
+ crypto \
+ common
STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
-LIBS += -lexpat $(LIB_THREAD) $(addprefix -lstg,$(STGLIBS))
+LIBS += $(addprefix -lstg,$(STGLIBS)) -lexpat $(LIB_THREAD)
ifeq ($(OS),linux)
else
CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
-LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
+LDFLAGS += $(STGLIBS_LIBS)
+
+ifneq ($(OS),darwin)
+LDFLAGS += -Wl,-E
+endif
.PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data
all: libs $(PROG) ../../Makefile.conf
install: install-bin
install-bin:
- install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
+ifeq ($(DEBUG), yes)
+ install -D -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/bin/$(PROG)
+else
+ install -D -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/bin/$(PROG)
+endif
$(MAKE) -C $(DIR_LIBSRC) install
uninstall: uninstall-bin
$(MAKE) -C $(DIR_LIBSRC)
@>deps ;\
for file in $(SRCS); do\
- echo "`$(CC) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
- echo -e '\t$$(CC) -c $$< $(CXXFLAGS)' >> deps ;\
+ echo "$$file" | grep ".c$$" > /dev/null;\
+ if [ $$? -eq 0 ];\
+ then\
+ echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
+ printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
+ else\
+ echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
+ printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\
+ fi;\
done
-
-