# This is a one of two related Makefiles for easy-DLL'ing.
# Change DYNMAKE below to the appropriate location
# The reason for two makefiles is that the .def file should never
# be automatically updated, but should be automatically created.
#
# Use like 
#
# make; make install; make clean
#
# or
#
# make definition; manually edit .DEF file; make; make install; make clean
# 
# Make realclean will erase .DEF file. Do not do this if you want to preserve
# binary compatibility between version.
#
# Change this location in the sample file and copy-on-write the sample ;-):

DYNMAKE = f:/emx.add/bin/Makefile.dynamic

### This should be customized for your particular library:

DEFS   = 
CFLAGS = -O
LIB = readline
LIBS = 
# INCLUDES =
OBJECTS = readline.obj

# Additional symbols to export (uninitialized externs???)

# ADDSYMBOLS = 

# Script to use to filter out unneeded symbols 
# (entry points in DLL are case-insensitive). Comment if not needed:

# Default (remove the case-dublicate symbols completely):
# SETFILTER = "FILTER=filtersym.cmd"

# No filtering:
# SETFILTER = "FILTER=@cmd /c rem"

### This is the end of customization section

RM = cmd /c del
MAKE2 =	$(MAKE) -f $(DYNMAKE) \
		LIB=$(LIB) "OBJECTS=$(OBJECTS)" "INCLUDES=$(INCLUDES)" \
		"DEFS=$(DEFS)" "LIBS=$(LIBS)" "CFLAGS=$(CFLAGS)" \
		"ADDSYMBOLS=$(ADDSYMBOLS)" $(SETFILTER)

.SUFFIXES:	.c .obj .lib

.c.obj:
	$(MAKE2) $*.obj


dynamic: $(LIB).dll $(LIB)_import.a $(LIB)_import.lib

definition: $(LIB).def

$(LIB).dll $(LIB)_import.a $(LIB)_import.lib : $(LIB).def $(OBJECTS)
	$(MAKE2)

$(LIB).def:
	$(MAKE2) definition

install: $(LIB).def $(LIB).dll $(LIB)_import.a $(LIB)_import.lib
	$(MAKE2) install 

clean:
	-$(RM) $(OBJECTS) $(LIB).dll $(LIB).lib $(LIB)_import.a $(LIB)_import.lib tmptmp.tmp $(LIB).tmp 2> nul

realclean: clean
	-$(RM) $(LIB).def 2> nul
