# Makefile for replzip

LIBZIP=../zlib-inst
DEFINES= -DNOCRYPT -DNO_ADDFILEINEXISTINGZIP

#CC=bcc32 
#CFLAGS=-5 -tWC -O1 -Oc -I$(LIBZIP)/include $(DEFINES)
#LDFLAGS=$(LIBZIP)/lib/libz.lib
#WILD = C:\BORLAND\BCC55\LIB\wildargs.obj

CC=gcc
CFLAGS=-Os -W -Wall -Wno-unused -Wno-uninitialized -I$(LIBZIP)/include $(DEFINES)
LDFLAGS= -L $(LIBZIP)/lib
LIBS  = -l z
WILD=

ZIP_OBJS = replzip.o zip.o ioapi.o iowin32.o

%.o: %.c
	$(CC) -c $(CFLAGS) $<
-include Makeupload

all: replzip.exe

replzip.exe: $(ZIP_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(ZIP_OBJS) $(LIBS) $(WILD)

dummylist: $(ZIP_OBJS)
	echo ## comment for the first file > $@
	ls -1 $^ >> $@

.PHONY:test
test: replzip.exe dummylist
	replzip -C "this is the global comment" test/test \
		-c "this is the local comment"            \
		-p replaced/directory *.txt replzip.exe   \
		-p somewhere/else @dummylist

%.zip:
	rm -f $@
	zip -9 $@ $^
	
upload: replzip.zip win32-pentium-executable.zip
	$(UPLOAD) $^
replzip.zip: *.c *.h Makefile COPYING
win32-pentium-executable.zip: replzip.exe COPYING

clean:
	rm -f *.obj *.o test/* dummylist

