# gnuish Makefile

#OPTIONS = -g -Wall -static
OPTIONS = -O2 -m486 -Wall
INCS    = -I./libinclude
LDOPTS	= -L/usr/local/lib -L./libs

SRCS =  deu.c gfx.c menus.c nodes.c textures.c edit.c levels.c mouse.c \
	objects.c things.c editobj.c names.c wads.c lnxfuncs.c

OBJS = $(SRCS:.c=.o)


# Add dependencies of .h-files if you like ...

%.o : %.c
	gcc -c $(OPTIONS) $(INCS) $<


deu: /lib/libvga.so.1 $(OBJS)
	gcc $(OPTIONS) $(LDOPTS) -o deu $(OBJS) -lm -lbcc -lgrx -lvga

/lib/libvga.so.1:
	cp libs/libvga.config.sample /usr/local/lib/libvga.config
	cp libs/libvga.et4000.sample /usr/local/lib/libvga.et4000
	cp libs/libvga.sa /usr/lib
	cp libs/libvga.so.1.1.8 /lib/libvga.so.1.1.8
	ldconfig -v
	@echo
	@echo \
"You must edit /usr/local/lib/libvga.config and /usr/local/lib/libvga.et4000" 
	@echo "to match your hardware."
	@echo

clean: 
	rm -f *.o deu installed
