#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'

# The build order is important.  
SUBDIRS = config share common jrtplib mas devices maslib clients 

#ifndef OSName
#define OSName Unknown Operating System!
#endif

MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

World: VerifyOS builddir
	$(MAKE) $(MFLAGS) Makefiles
	$(MAKE) $(MFLAGS) clean
	$(MAKE) $(MFLAGS) includes
	$(MAKE) $(MFLAGS) depend
	$(MAKE) $(MFLAGS)

debug:
	$(MAKE) $(MFLAGS) CDEBUGFLAGS="-g -DDEBUG" CXXDEBUGFLAGS="-g"

gprof:
	$(MAKE) $(MFLAGS) CDEBUGFLAGS="-g -pg -DDEBUG"

debug3:
	$(MAKE) $(MFLAGS) CDEBUGFLAGS="-g -DDEBUG=3"

builddir:
	$(MKDIRHIER) $(BUILDLIBDIR)
	$(MKDIRHIER) $(BUILDINCDIR)
	$(MKDIRHIER) $(BUILDBINDIR)

clean::
	$(RM) -r $(BUILDLIBDIR)
	$(RM) -r $(BUILDINCDIR)
	$(RM) -r $(BUILDBINDIR)
	make builddir

VerifyOS::
	@echo "*****************************************************************"
	@echo "Building MAS"

	@echo ""
	@echo Building on OSName "("OSMajorVersion"."OSMinorVersion"."OSTeenyVersion")."
	@echo ""
#ifdef LinuxArchitecture
	@echo Linux Distribution: LinuxDistName
	@echo libc version: LinuxCLibMajorVersion"."LinuxCLibMinorVersion"."LinuxCLibTeenyVersion
	@echo binutils version: `expr LinuxBinUtilsMajorVersion / 10`.`expr LinuxBinUtilsMajorVersion % 10`
#endif
	@echo ""
	@echo "With optional code requiring modules:"
#if HasMAD
	@echo "mad           yes"
#else
	@echo "mad           no"
#endif
#if HasGnome2
	@echo "gnome 2.x     yes"
#else
	@echo "gnome 2.x     no"
#endif
#if HasGtk2
	@echo "gtk 2.x       yes"
#else
	@echo "gtk 2.x       no"
#endif
#if HasFFTW
	@echo "fftw          yes"
#else
	@echo "fftw          no"
#endif
#if HasLibstdcplusplus
	@echo "libstdc++     yes"
#else
	@echo "libstdc++     no"
#endif
	@echo "*****************************************************************"
