CFLAGS=-c -mcpu=pentiumpro -O3 -Wall
LFLAGS=-s
LIBS=

RM=rm
CC=gcc
DLLTOOL=dlltool
M4=m4

DEF=ntevent.def
OBJS=ntevent.o ntevent.res.o
TARGET=ntevent.dll

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(LFLAGS) -mdll -o nul -Xlinker --base-file -Xlinker $@.base $^ $(LIBS)
	$(DLLTOOL) --dllname $@ --base-file $@.base --output-exp $@.exp --def $(DEF)
	$(CC) $(LFLAGS) -mdll  -o $@ $^ $@.exp $(LIBS)
	$(RM) $@.base
	$(RM) $@.exp

ntevent.o: ntevent.cpp el_utils.cpp evplugin.h el_config.cpp
	$(CC) $(CFLAGS) $< -o $@

ntevent.res.o: ntevent.rc
	windres -i $< -o $@

clear:
	$(RM) *.o
	$(RM) $(TARGET)
