#
# Makefile.mingw
#
# Description: Makefile for idletrack
#

#
# PATHS
#

GAIM_TOP :=		../../..
GAIM_INSTALL_DIR :=	$(GAIM_TOP)/win32-install-dir

##
## VARIABLE DEFINITIONS
##

TARGET = idletrack

# Compiler Options

CFLAGS =

DEFINES =

##
## INCLUDE  MAKEFILES
##

include $(GAIM_TOP)/src/win32/global.mak

##
## INCLUDE PATHS
##

INCLUDE_PATHS +=

LIB_PATHS =

##
##  SOURCES, OBJECTS
##

C_SRC =			idletrack.c

OBJECTS = $(C_SRC:%.c=%.o)


##
## LIBRARIES
##

LIBS =

##
## RULES
##

# How to make a C file

%.o: %.c
	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $<

##
## TARGET DEFINITIONS
##

.PHONY: all clean

all: $(TARGET).dll

install:


##
## BUILD DLL
##

$(TARGET).def: $(OBJECTS)
	dlltool --dllname $(TARGET).dll -z $(TARGET).def $(OBJECTS)

$(TARGET).base: $(OBJECTS)
	$(CC) -mdll -o junk.tmp -Wl,--base-file,$@ $(OBJECTS) $(LIB_PATHS) $(LIBS)
	rm -rf junk.tmp

$(TARGET).exp: $(TARGET).def $(TARGET).base
	dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \
		--output-exp $(TARGET).exp --def $(TARGET).def
	rm -rf $(TARGET).base

$(TARGET).dll: $(OBJECTS) $(TARGET).exp
	$(CC) -mdll -o $(TARGET).dll $(OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(LIBS)
	dlltool -D $(TARGET).dll -d $(TARGET).def -l $(TARGET).lib
	rm -rf $(TARGET).exp

##
## CLEAN RULES
##

clean:
	rm -rf *.o
	rm -rf $(TARGET).dll
	rm -rf $(TARGET).lib
	rm -rf $(TARGET).def
