# lib/Makefile.w32 - Makefile for W32 port.
# Copyright (C) 1995 - 2006 Michael Riepe
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# @(#) $Id: Makefile.w32,v 1.1 2008/06/16 00:01:21 cjohns Exp $

instroot =

prefix = 
exec_prefix = 
libdir = 
includedir = 
installdirs = $(libdir) $(includedir) $(includedir)/libelf

CC = cl /nologo
LD = link /nologo
AR = 
MV = 
RM = del
LN_S = 
RANLIB = 
INSTALL = 
INSTALL_DATA = 
INSTALL_PROGRAM = 

CFLAGS = /O2 /W2 /TC /MD
CPPFLAGS = 
DEFS = /DHAVE_CONFIG_H
LDFLAGS = 
LIBS = 
DEPSHLIBS = 

DO_SHLIB = 
PICFLAGS = 
SHLIB_SFX = .dll
SHLINK_SFX = 
SONAME_SFX = 
LINK_SHLIB = $(LD) /DLL $(LDFLAGS)

SHLIB = libelf$(SHLIB_SFX)
SHLINK = libelf$(SHLINK_SFX)
SONAME = libelf$(SONAME_SFX)

# install includes in includedir?
DO_COMPAT = 

INCLUDES = /I.

COMPILE = $(CC) /c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)

# no user serviceable parts below

PACKAGE = libelf
VERSION = 0.8.9
MAJOR = 0

SHELL = /bin/sh

srcdir = .
top_srcdir = ..

topdir = ..
subdir = lib

.SUFFIXES:
.SUFFIXES: .obj .c
.c.obj:
	$(COMPILE) $<

# generic sources
SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \
	getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \
	ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \
	rawfile.c strptr.c update.c version.c checksum.c
OBJS1 = $(SRCS1:.c=.obj)

# 32-bit sources
SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \
	32.newphdr.c 32.xlatetof.c
OBJS2 = $(SRCS2:.c=.obj)

# support
SRCS3 = cook.c data.c input.c assert.c
OBJS3 = $(SRCS3:.c=.obj)

# nlist
SRCS4 = nlist.c
OBJS4 = $(SRCS4:.c=.obj)

# opt
SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c
OBJS5 = $(SRCS5:.c=.obj)

# 64-bit sources
SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c
OBJS64 = $(SRCS64:.c=.obj)

# Versioning sources
SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c
OBJS_V = $(SRCS_V:.c=.obj)
HDRS_V = verdef.h verneed.h

SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V)
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V)

# missing functions
LIBSRCS = memset.c
LIBOBJS = 

# public header files
HDRS = libelf.h nlist.h gelf.h

# public header files (created by configure)
AUXHDRS = sys_elf.h

# private header files
PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h $(HDRS_V)

DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in

all: $(OBJS) $(SHLIB)

check:

$(SHLIB): libelf.def $(OBJS) $(LIBOBJS)
	-@$(RM) $(SHLIB)
	$(LINK_SHLIB) /OUT:"$(SHLIB)" /DEF:"libelf.def" $(OBJS) $(LIBOBJS) kernel32.lib

install:

mostlyclean:
	-$(RM) *.obj
	-$(RM) $(SHLIB)
	-$(RM) libelf.lib
	-$(RM) libelf.exp

clean: mostlyclean

distclean: clean
	-$(RM) $(AUXHDRS)

maintainer-clean: distclean

# dependencies
$(OBJS): private.h config.h libelf.h gelf.h errors.h $(AUXHDRS)
32.fsize.obj: ext_types.h
32.xlatetof.obj: byteswap.h ext_types.h
64.xlatetof.obj: byteswap.h ext_types.h
getarsym.obj: byteswap.h
memset.obj: config.h
nlist.obj: nlist.h
swap64.obj: byteswap.h
$(OBJS_V): byteswap.h ext_types.h $(HDRS_V)
