<?xml version="1.0" ?>
<makefile>
	<set var="EOL_STYLE">unix</set>

	<!-- =========================================================
	 OPTIONS
	 ========================================================= -->
	<option name="BUILD">
		<values>debug,release</values>
		<default-value>release</default-value>
	</option>
	<option name="CHAR">
		<values>wchar,mchar</values>
		<default-value>wchar</default-value>
	</option>
	<option name="XCMGRS">
		<values>on,off</values>
		<default-value>on</default-value>
	</option>
	<option name="BUNDLED_UNICODE">
		<values>on,off</values>
		<default-value>on</default-value>
	</option>
	<option name="TCPV40HDRS">
		<!-- this is OS/2 specific. no effect on other platforms -->
		<values>on,off</values>
		<default-value>off</default-value>
	</option>

	<!-- =========================================================
	 AWK MODULE DATA
	  the values here must match QSE_AWK_DEFAULT_MODPREFIX and
	  QSE_AWK_DEFAULT_MODPOSTFIX in lib/awk/parse.c since we don't
	  redefine and pass them to the compiler.
	 ========================================================= -->
	<set var="AWKMODPREFIX">
		<if cond="PLATFORM_WIN32=='1'">qseawk-</if>
		<if cond="PLATFORM_OS2=='1'">awk-</if>
		<if cond="PLATFORM_MSDOS=='1'">awk-</if>
		<if cond="PLATFORM_UNIX=='1'">libqseawk-</if>
	</set>
	<set var="AWKMODPOSTFIX">
		<if cond="PLATFORM_WIN32=='1'"></if>
		<if cond="PLATFORM_OS2=='1'"></if>
		<if cond="PLATFORM_MSDOS=='1'"></if>
		<if cond="PLATFORM_UNIX=='1'"></if>
	</set>
	
	<!-- =========================================================
	 BUILD DIRECTORY
	 ========================================================= -->
	<set var="BUILDDIR_BUILD">
		<if cond="BUILD=='debug'">debug</if>
		<if cond="BUILD=='release'">release</if>
	</set>
	<set var="BUILDDIR_CHAR">
		<if cond="CHAR=='wchar'">wchar</if>
		<if cond="CHAR=='mchar'">mchar</if>
	</set>
	<set var="BUILDDIR">
		$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)
	</set>

	<!-- =========================================================
	 EXTRA CPPFLAGS
	 ========================================================= -->
	<set var="CPPFLAGS_BUILD">
		<if cond="BUILD=='debug'">-DQSE_BUILD_DEBUG -DDEBUG -D_DEBUG</if>
		<if cond="BUILD=='release'">-DNDEBUG</if>
	</set>
	<set var="CPPFLAGS_CHAR">
		<if cond="CHAR=='wchar'">-DQSE_CHAR_IS_WCHAR=1</if>
		<if cond="CHAR=='mchar'">-DQSE_CHAR_IS_MCHAR=1</if>
	</set>
	<set var="CPPFLAGS_XCMGRS">
		<if cond="XCMGRS=='on'">-DQSE_ENABLE_XCMGRS=1</if>
		<if cond="XCMGRS=='off'">-UQSE_ENABLE_XCMGRS</if>
	</set>
	<set var="CPPFLAGS_BUNDLED_UNICODE">
		<if cond="BUNDLED_UNICODE=='on'">-DQSE_ENABLE_BUNDLED_UNICODE=1</if>
		<if cond="BUNDLED_UNICODE=='off'">-UQSE_ENABLE_BUNDLED_UNICODE</if>
	</set>
	<set var="CPPFLAGS_TCPV40HDRS">
		<if cond="TCPV40HDRS=='on'">-DTCPV40HDRS</if>
		<if cond="TCPV40HDRS=='off'">-UTCPV40HDRS</if>
	</set>
	<set var="CPPFLAGS_EXTRA">
		$(CPPFLAGS_BUILD)
		$(CPPFLAGS_CHAR)
		$(CPPFLAGS_XCMGRS)
		$(CPPFLAGS_BUNDLED_UNICODE)
		$(CPPFLAGS_TCPV40HDRS)
	</set>

	<!-- =========================================================
	 DEBUG INFORMATION
	 ========================================================= -->
	<set var="DEBUG_INFO">
		<if cond="BUILD=='debug'">on</if>
		<if cond="BUILD=='release'">off</if>
	</set>

	<!-- =========================================================
	 CONDITIONAL SOURCE FILES
	 ========================================================= -->
	<set var="SOURCES_XCMGRS">
		<if cond="XCMGRS=='on'">cp949.c cp950.c</if>
	</set>
	<set var="SOURCES_BUNDLED_UNICODE">
		<if cond="BUNDLED_UNICODE=='on'">uni.c</if>
	</set>

	<!-- =========================================================
	 CONDITIONAL SYSTEM LIBRARIES
	 ========================================================= -->
	<set var="SYSLIB_SOCKET">
		<if cond="PLATFORM_WIN32=='1'">ws2_32</if>
		<if cond="PLATFORM_OS2=='1' and TCPV40HDRS=='on'">tcp32dll</if>
		<if cond="PLATFORM_OS2=='1' and TCPV40HDRS=='off'">tcpip32</if>
	</set>
	<set var="SYSLIB_SOCKET2">
		<if cond="PLATFORM_OS2=='1' and TCPV40HDRS=='on'">so32dll</if>
	</set>

	<!-- =========================================================
	 TEMPLATES
	 ========================================================= -->
	<template id="base">
		<include>../../include</include>
		<cppflags>$(CPPFLAGS_EXTRA)</cppflags>
		<warnings>max</warnings>
		<debug-info>$(DEBUG_INFO)</debug-info>
		<threading>multi</threading>
		<optimize>speed</optimize>
	</template>
	<template id="basexx">
		<cxx-exceptions>on</cxx-exceptions>
	</template>

	<!-- =========================================================
	 TARGETS
	 ========================================================= -->
	<dll id="dllqsecmn" template="base">
		<libname>qsecmn</libname>
		<dllname>qsecmn</dllname>
		<set-srcdir>../../lib/cmn</set-srcdir>
		<sources>
			alg-base64.c 
			alg-rand.c 
			alg-search.c  
			alg-sort.c 
			assert.c 
			chr.c 
			dir.c 
			dll.c 
			env.c 
			gdl.c 
			htb.c 
			fio.c 
			fma.c 
			fmt.c 
			fs.c 
			fs-err.c 
			fs-move.c 
			glob.c 
			hton.c 
			ipad.c 
			lda.c 
			main.c 
			mbwc.c 
			mbwc-str.c 
			mem.c 
			mux.c 
			nwad.c 
			nwad-skad.c 
			nwif.c 
			nwif-cfg.c 
			nwio.c 
			oht.c 
			opt.c 
			path-basename.c 
			path-canon.c 
			pio.c 
			pma.c 
			rbt.c 
			rex.c 
			sio.c 
			sll.c 
			slmb.c 
			stdio.c 
			str-beg.c 
			str-cat.c 
			str-chr.c 
			str-cnv.c 
			str-cmp.c 
			str-cpy.c 
			str-del.c 
			str-dup.c 
			str-dynm.c 
			str-dynw.c 
			str-end.c 
			str-excl.c 
			str-fcpy.c 
			str-fnmat.c 
			str-incl.c 
			str-len.c 
			str-pac.c 
			str-pbrk.c 
			str-put.c 
			str-rev.c 
			str-rot.c 
			str-set.c 
			str-spl.c 
			str-spn.c 
			str-str.c 
			str-subst.c 
			str-tok.c 
			str-trm.c 
			str-word.c 
			task.c 
			time.c 
			tio.c 
			tre.c 
			tre-ast.c 
			tre-compile.c 
			tre-match-backtrack.c 
			tre-match-parallel.c 
			tre-parse.c 
			tre-stack.c 
			uri.c 
			utf8.c 
			xma.c
			$(SOURCES_XCMGRS)
			$(SOURCES_BUNDLED_UNICODE)
		</sources>
		<sys-lib>$(SYSLIB_SOCKET)</sys-lib>
		<sys-lib>$(SYSLIB_SOCKET2)</sys-lib>
	</dll>

	<dll id="dllqseawk" template="base">
		<libname>qseawk</libname>
		<dllname>qseawk</dllname>
		<set-srcdir>../../lib/awk</set-srcdir>
		<sources>
			awk.c 
			err.c 
			tree.c 
			parse.c 
			run.c 
			rec.c 
			val.c 
			fnc.c 
			misc.c
			rio.c 
			std.c 
		</sources>
		<library>dllqsecmn</library>
		<depends>dllqsecmn</depends>
	</dll>

	<dll id="modqseawkdir" template="base">
		<dllname>$(AWKMODPREFIX)dir$(AWKMODPOSTFIX)</dllname>
		<libname>$(AWKMODPREFIX)dir$(AWKMODPOSTFIX)</libname>
		<set-srcdir>../../mod/awk</set-srcdir>
		<sources>dir.c</sources>
		<library>dllqsecmn</library>
		<library>dllqseawk</library>
		<depends>dllqseawk</depends>
	</dll>

	<dll id="modqseawkstr" template="base">
		<dllname>$(AWKMODPREFIX)str$(AWKMODPOSTFIX)</dllname>
		<libname>$(AWKMODPREFIX)str$(AWKMODPOSTFIX)</libname>
		<set-srcdir>../../mod/awk</set-srcdir>
		<sources>str.c</sources>
		<library>dllqsecmn</library>
		<library>dllqseawk</library>
		<depends>dllqseawk</depends>
	</dll>

	<dll id="modqseawksys" template="base">
		<dllname>$(AWKMODPREFIX)sys$(AWKMODPOSTFIX)</dllname>
		<libname>$(AWKMODPREFIX)sys$(AWKMODPOSTFIX)</libname>
		<set-srcdir>../../mod/awk</set-srcdir>
		<sources>sys.c</sources>
		<library>dllqsecmn</library>
		<library>dllqseawk</library>
		<depends>dllqseawk</depends>
	</dll>

	<dll id="dllqsesed" template="base">
		<libname>qsesed</libname>
		<dllname>qsesed</dllname>
		<set-srcdir>../../lib/sed</set-srcdir>
		<sources>
			sed.c
			err.c
			std.c 
		</sources>
		<library>dllqsecmn</library>
		<depends>dllqsecmn</depends>
	</dll>

	<dll id="dllqsenet" template="base">
		<libname>qsenet</libname>
		<dllname>qsenet</dllname>
		<set-srcdir>../../lib/net</set-srcdir>
		<sources>
			http.c 
			htre.c
			htrd.c 
			httpd.c 
			httpd-cgi.c 
			httpd-dir.c
			httpd-file.c
			httpd-proxy.c
			httpd-resol.c 
			httpd-std.c
			httpd-task.c
			httpd-text.c 
			upxd.c   
		</sources>
		<library>dllqsecmn</library>
		<depends>dllqsecmn</depends>
		<sys-lib>$(SYSLIB_SOCKET)</sys-lib>
		<sys-lib>$(SYSLIB_SOCKET2)</sys-lib>
	</dll>

	<exe id="exeqseawk" template="base">
		<exename>qseawk</exename>
		<app-type>console</app-type>
		<set-srcdir>../../cmd/awk</set-srcdir>
		<sources>awk.c</sources>
		<library>dllqsecmn</library>
		<library>dllqseawk</library>
		<depends>dllqseawk</depends>
		<sys-lib>$(SYSLIB_SOCKET)</sys-lib>
		<sys-lib>$(SYSLIB_SOCKET2)</sys-lib>
	</exe>

	<exe id="exeqsesed" template="base">
		<exename>qsesed</exename>
		<app-type>console</app-type>
		<set-srcdir>../../cmd/sed</set-srcdir>
		<sources>sed.c</sources>
		<library>dllqsecmn</library>
		<library>dllqsesed</library>
		<depends>dllqsesed</depends>
	</exe>

	<exe id="exeqsehttpd" template="base">
		<exename>qsehttpd</exename>
		<app-type>console</app-type>
		<set-srcdir>../../cmd/net</set-srcdir>
		<sources>httpd.c</sources>
		<library>dllqsecmn</library>
		<library>dllqsenet</library>
		<depends>dllqsenet</depends>
		<sys-lib>$(SYSLIB_SOCKET)</sys-lib>
		<sys-lib>$(SYSLIB_SOCKET2)</sys-lib>
	</exe>

	<dll id="dllqsecmnxx" template="base,basexx">
		<libname>qsecmnxx</libname>
		<dllname>qsecmnxx</dllname>
		<set-srcdir>../../lib/cmn</set-srcdir>
		<sources>
			Mmgr.cpp
			StdMmgr.cpp
		</sources>
		<library>dllqsecmn</library>
		<depends>dllqsecmn</depends>
	</dll>

	<dll id="dllqseawkxx" template="base,basexx">
		<libname>qseawkxx</libname>
		<dllname>qseawkxx</dllname>
		<set-srcdir>../../lib/awk</set-srcdir>
		<sources>
			Awk.cpp
			StdAwk.cpp
		</sources>
		<library>dllqsecmn</library>
		<library>dllqsecmnxx</library>
		<library>dllqseawk</library>
		<depends>dllqsecmnxx</depends>
		<depends>dllqseawk</depends>
	</dll>

	<dll id="dllqsesedxx" template="base,basexx">
		<libname>qsesedxx</libname>
		<dllname>qsesedxx</dllname>
		<set-srcdir>../../lib/sed</set-srcdir>
		<sources>
			Sed.cpp
			StdSed.cpp
		</sources>
		<library>dllqsecmn</library>
		<library>dllqsecmnxx</library>
		<library>dllqsesed</library>
		<depends>dllqsecmnxx</depends>
		<depends>dllqsesed</depends>
	</dll>

</makefile>
