#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is the Mozilla OS/2 libraries.
#
# The Initial Developer of the Original Code is John Fairhurst,
# <john_fairhurst@iname.com>.  Portions created by John Fairhurst are
# Copyright (C) 1999 John Fairhurst. All Rights Reserved.
#

DEPTH		= ../../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

OS2_LIBRARYNAME	= wdgtres
DLL		= wdgtres.dll

RCOPTS		= -n -x2 -I .

ifneq ($(MOZ_OS2_TOOLS),VACPP)
OMF_FLAG	= -Zomf
endif

include $(topsrcdir)/config/rules.mk

export::

libs:: $(DLL)
	$(INSTALL) -m 444 $(DLL) $(DIST)/bin

# XXX Have to copy files because rc and link386 are too stupid for a mirror tree build
$(DLL): wdgtres.obj wdgtres.res
ifeq ($(MOZ_OS2_TOOLS),VACPP) # link386 dies on fatal error L1104: R:\IBMCXXO\LIB\cpprss36.lib : not valid library
	ilink /nol wdgtres.obj /O:$@ wdgtres.def
else
	link386 /nol wdgtres,$@,nul,,wdgtres.def
endif
	rc $(RCOPTS) wdgtres.res $@

wdgtres.res: wdgtres.rc
	cp $(topsrcdir)/widget/src/os2/resID.h ./resID.h
ifneq ($(DEPTH),$(topsrcdir))
	cp $(srcdir)/frame.ico ./frame.ico
	cp $(srcdir)/folder.ico ./folder.ico
	cp $(srcdir)/dragitem.ico ./dragitem.ico
	cp $(srcdir)/*.ptr .
	cp $(srcdir)/wdgtres.def ./wdgtres.def
endif
	rc $(RCOPTS) -r $(srcdir)/wdgtres.rc $@

wdgtres.obj: wdgtres.C
	$(CC) -o $@ -s -c $(CFLAGS) $(OMF_FLAG) $<

realclean clean::
	rm -rf $(DLL) *.res *.obj
ifneq ($(DEPTH),$(topsrcdir))
	rm -rf *.ico *.h *.def
endif

