all: ../ninox ../videoshow

CFLAGS=-I/usr/local/include -L/usr/local/lib -O3 -msse -fstack-protector -D_FORTIFY_SOURCE=2

version:
	perl increment.pl version.h
	perl makecommands.pl

.c.o:
	gcc $(CFLAGS) -c $<

all: version ../ninox ../videoshow ../ftacompress

OBJ=stack.o usage.o globals.o scale.o fileio.o debayer.o \
	align.o process.o quality.o commands.o morphing.o subsample.o \
	hotpixels.o util.o tables.o streamfilter.o rotate.o gaincomp.o fft.o \
	fftutil.o transpose.o font.o display.o keyboard.o switches.o globals.o \
	ftacompress.o darkframe.o memory.o

ninox.o: ninox.c version
	gcc $(CFLAGS) -c ninox.c

../ninox: $(OBJ) ninox.o
	-rm nlib.a
	ar cqv nlib.a $(OBJ)
	gcc -o ../ninox ninox.o nlib.a -lm -lSDL2

../videoshow: videoshow.c nlib.a
	gcc $(CFLAGS) videoshow.c nlib.a -o ../videoshow -lm -lSDL2

../ftacompress: ftacompress.c nlib.a
	gcc $(CFLAGS) -DFTACOMPRESS_STANDALONE ftacompress.c nlib.a -o ../ftacompress -lm -lSDL2

clean:
	rm -f $(OBJ) ninox.o nlib.a

