#-*- Makefile -*-
include ../../gnuwin32/MkRules

MODULE=internet
all: makeMakedeps ../../../modules/internet.dll ../../../modules/internet2.dll

CSOURCES=internet.c sockconn.c Rsock.c sock.c
CSOURCES2=nanoftp.c nanohttp.c

CFLAGS=$(OPTFLAGS) -I../../include -I../../gnuwin32 -DHAVE_CONFIG_H

DLLLIBS=-L../../gnuwin32 -lR -lwsock32
internet2-DLLLIBS=-lwininet

../../../modules/internet.dll: internet.dll
	$(MKDIR) -p ../../../modules
	$(CP) $< $@

internet.dll: internet.o sockconn.o Rsock.o sock.o $(CSOURCES2:.c=.o) dllversion.o

../../../modules/internet2.dll: internet2.dll
	$(MKDIR) -p ../../../modules
	$(CP) $< $@

internet2.dll: internet2.o sockconn.o Rsock.o sock.o dllversion.o

internet2.o: internet.c
	$(CC)  $(CFLAGS) -DUSE_WININET -c $< -o $@

dllversion.o: ../../include/Rversion.h

clean:
	@$(RM) Makedeps *.d *.o *.def *.dll

# Dependencies
DEPS=$(CSOURCES:.c=.d) $(CSOURCES2:.c=.d)

makeMakedeps: $(DEPS)
	@$(RM) Makedeps
	@cat $(DEPS) >> Makedeps

-include Makedeps
