CC=gcc
CFLAGS=-funsigned-char -Wall -ggdb

setup.exe: setup.o resources.o file_lib.o util_lib.o scriplib.o
	$(CC) $(CFLAGS) -o $@ $^ -mwindows -lwinmm -lmingwex -lcomctl32 -lm
	

setup.o: setup.c dialogs.h _functio.h scriplib.h
resources.o: resources.rc dialogs.h dialogs.dlg
file_lib.o: file_lib.c file_lib.h types.h
util_lib.o: util_lib.c util_lib.h types.h
scriplib.o: scriplib.c scriplib.h types.h util_lib.h file_lib.h _scrplib.h

%.o: %.rc
	windres -o $@ -i $< -DRC

.PHONY: packexe package
packexe: setup.exe
	strip $^
	upx --best $^

sourcedir=setup_src_$(shell date +%Y%m%d)

package: packexe
	mkdir $(sourcedir)
	cp *.h *.c Makefile GNU.TXT *.ico *.rc dialogs.dlg dialogs.res $(sourcedir)
	kzip -r $(sourcedir).zip $(sourcedir)

