#
# 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	= gfxres
DLL		= gfxres.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): gfxres.obj gfxres.res
ifeq ($(MOZ_OS2_TOOLS),VACPP) # link386 dies on fatal error L1104: R:\IBMCXXO\LIB\cpprss36.lib : not valid library
	ilink /nol gfxres.obj /O:$@ gfxres.def
else
	link386 /nol gfxres,$@,nul,,gfxres.def
endif
	rc $(RCOPTS) gfxres.res $@

gfxres.res: gfxres.rc
	cp $(topsrcdir)/gfx/src/os2/resID.h ./resID.h
ifneq ($(DEPTH),$(topsrcdir))
	cp $(srcdir)/libprint.ico ./libprint.ico
	cp $(srcdir)/gfxres.def ./gfxres.def
endif
	rc $(RCOPTS) -r $(srcdir)/gfxres.rc $@

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

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

