ANSI = 1
USERCPP = -I ./FStdLib -D__NOMEM__=1 -D__USEASSERT__=1 -Wno-unknown-pragmas -Wno-switch -Wno-missing-braces -Wno-parentheses

include ../../far/makefile_gcc_common

include ../makefile_gcc_def_inc

DLLNAME = libFARStd.a
DLLFULLNAME = $(OBJDIR)/$(DLLNAME)

SRCS = fstd_Arg.cpp fstd_asrt.cpp fstd_ClpS.cpp fstd_Con.cpp \
       fstd_crc32.cpp fstd_Dialog.cpp fstd_err.cpp fstd_exit.cpp \
       fstd_exSCAT.cpp fstd_exSCMP.cpp fstd_exSCPY.cpp fstd_exSPCH.cpp \
       fstd_exSPS.cpp fstd_FMsg.cpp fstd_FUtils.cpp fstd_ilist.cpp fstd_INProc.cpp fstd_log.cpp \
       fstd_menu.cpp fstd_mesg.cpp fstd_mklog.cpp fstd_Msg.cpp \
       fstd_OEM.cpp fstd_Patt.cpp fstd_per.cpp fstd_plg.cpp fstd_Reg.cpp \
       fstd_SCol.cpp fstd_scr.cpp fstd_stdlibCS.cpp fstd_SText.cpp \
       fstd_String.cpp fstd_Utils.cpp

OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(filter %.cpp,$(SRCS)))
DEPS = $(patsubst %.cpp,$(OBJDIR)/%.d,$(filter %.cpp,$(SRCS)))

all: $(DLLFULLNAME)

ifndef DISABLEAUTODEPS
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
$(OBJDIR)/%.d: ./FStdLib/FARStdlib/%.cpp
	@echo making depends for $<
	@$(MKDIR) $(@D)
	@$(CXX) -c -MM $(CXXFLAGS) $< | $(GAWK) -f $(DEP_FILTER) -v n=$(notdir $(basename $@)) -v r=$(OBJDIR) > $(call os_name,$@)
endif
endif

$(OBJDIR)/%.o: ./FStdLib/FARStdlib/%.cpp
	@echo compiling $<
	@$(MKDIR) -p $(@D)
	@$(CXX) $(CXXFLAGS) -c -o $@ $<

$(DLLFULLNAME): $(OBJS)
	@echo linking $@
	@$(MKDIR) -p $(@D)
	@$(AR) rc $(DLLNAME) $(OBJS)
	@$(RANLIB) $(DLLNAME)
	@$(MV) $(DLLNAME) $(OBJDIR)

-include $(DEPS)
