#
#  SFX to archive converter
#
#  Copyright (c) 2008, Veacheslav Patkov.
#  aLL rigths reserved.
#

CC = gcc

ifeq ($(mode),release)
  CFLAGS = -Wall -c -O3 -fno-exceptions -o
  LFLAGS = -Wall -mwindows -mdll -e _dllentry@12 -s -nostartfiles -o
else
  CFLAGS = -Wall -g -c -o
  LFLAGS = -Wall -g -mwindows -mdll -e _dllentry@12 -nostartfiles -o
endif

RC = rc
CVTRES = cvtres /machine:ix86

sfx2ar.dll: sfx2ar.o rsrc.obj
	$(CC) $(LFLAGS) $@ $^
sfx2ar.o: sfx2ar.c
	$(CC) $(CFLAGS) $@ $<
rsrc.obj: rsrc.res
	$(CVTRES) $<
rsrc.res: rsrc.rc
	$(RC) $<
install: sfx2ar.dll
	-mv -f $< ../../
clean:
	-rm -f *.o *.obj *.res
clean-all: clean
	-rm -f *.dll

.PHONY: clean clean-all
