# to compile the program under linux you need root privilegs
# if the automatic detection of the system doesn't work define 'linux' if
# compiling under linux and don't define it if compiling under dos
ifndef GO32
linux	= 1
endif

# must be gcc. BorlandC or MicrosoftC wouln't run
CC	= gcc
ifdef linux
RM	= rm -f
LIB	= -lvga
else
RM	= del
endif
CFLAGS	= -O2 -Wall

all: video

video:	v_access.o vid_main.o
	$(CC) -o video vid_main.o v_access.o $(LIB)
ifndef linux
	coff2exe video
	$(RM) video
else
	chmod a+s video
endif

video_bw:	v_access.o vid_bw.o
ifndef linux
	echo sorry, video_bw only possible with Linux
else
	$(CC) -o video_bw vid_bw.o v_access.o $(LIB)
	chmod a+s video_bw
endif

v_access.o:	v_access.c v_access.h
	$(CC) $(CFLAGS) -c v_access.c

vid_main.o:	vid_main.c v_access.h
	$(CC) $(CFLAGS) -c vid_main.c

vid_bw.o:	vid_bw.c v_access.h
	$(CC) $(CFLAGS) -c vid_bw.c
	
clean:
	$(RM) v_access.o
	$(RM) vid_main.o
ifndef linux
	$(RM) video.exe
else
	$(RM) video
endif

lib:	v_access.o
	ar rc libvideo.a v_access.o
	ranlib libvideo.a
