CC=gcc -bi486-linuxaout

PROGS=g3vga gifvga g32ps

# To compile with mouse capabilities unhash the following (this part is
# still in the testing stages only - but works) unhash the following line
MOUSE_SUPPORT=true

# See the color defines in vgaui.h
PAGE_COLOR=BLACK
TEXT_COLOR=WHITE
BORDER_COLOR=RED
TITLE_FG_COLOR=YELLOW
TITLE_BG_COLOR=BLUE

MOUSE_POINTER_COLOR=LIGHTGREEN
# The following is the amount to pan when the mouse is moved past
# the edge of the screen.
MOUSE_SCROLL_STEP=16

# BEWARE * BEWARE * BEWARE * BEWARE * BEWARE * BEWARE * BEWARE * BEWARE 
# Because g3vga is suid root, if you use relative paths your system security
# can be broken. Please use absolute paths for this print command. The
# "%s" is substituted with the current viewed file.
PRINT_COMMAND=/usr/bin/g32ps %s | /usr/bin/lpr

# For another font look in your /usr/lib/kbd/consolefonts directory
# for others names. Leave the entries blank for the default font as you
# may not have the fonts that I have (like antique and script). Note how the
# extension may be left out as well. See the ./font/README file. 
TITLE_FONT=antique-16
PROMPT_FONT=script-16
INPUT_FONT=972.cp
MENU_FONT=ro

# Name template is the way filenames are deciphered. Used only in the
# page goto facility in the viewer. The following suffices for "efax"
# page numbering. Leave it alone if you are unsure.
NAME_TEMPLATE="%s.%03d"

# For my debugging purposes only
#MDEBUG=1

ifdef MOUSE_SUPPORT
MOUSE_DEFINES=	-DMOUSE_SUPPORT \
		-DMOUSE_SCROLL_STEP=$(MOUSE_SCROLL_STEP) \
		-DMOUSE_POINTER_COLOR=$(MOUSE_POINTER_COLOR)

endif

CFLAGS=	-DPAGE_COLOR=$(PAGE_COLOR) \
	-DTEXT_COLOR=$(TEXT_COLOR) \
	-DBORDER_COLOR=$(BORDER_COLOR) \
	-DTITLE_FG_COLOR=$(TITLE_FG_COLOR) \
	-DTITLE_BG_COLOR=$(TITLE_BG_COLOR) \
	-DTITLE_FONT=\"$(TITLE_FONT)\" -DPROMPT_FONT=\"$(PROMPT_FONT)\" \
	-DINPUT_FONT=\"$(INPUT_FONT)\" -DMENU_FONT=\"$(MENU_FONT)\" \
	-DNAME_TEMPLATE=\"$(NAME_TEMPLATE)\" \
	$(MOUSE_DEFINES) \
	-O2 -I. -Imisc -DMMAP #-m486
LDFLAGS=-s
LDLIBS=-L/usr/local/lib -lvga

ifdef MDEBUG
CFLAGS+=-g -DMALLOC_TRACE -I../malloc
LDLIBS=-g -L/usr/src/svgalib/src -L../malloc -lvga -lmalloc_d
endif

all: $(PROGS)

vgaui.o: vgaui.c vgaui.h #Makefile
	$(CC) -c $(CFLAGS) -DPRINT_COMMAND="\"$(PRINT_COMMAND)"\" vgaui.c

help.h: help.asc
	echo "static const char *help_text[] = {" >$@
	awk -F"\t" '! /^#/ {print "\"" $$0 "\","}' help.asc >>$@
	echo "NULL};" >>$@

g32ps: g3decode.c
	$(CC) -N -DPRINT $(CFLAGS) $^ -o $@ $(LDFLAGS)

g3vga gifvga:
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)

misc/libvgamisc.a: misc/*[ch]
	cd misc; make CC="$(CC)" CFLAGS="$(CFLAGS)" libvgamisc.a

clean:
	rm -f $(PROGS) *.o gif/*.o misc/*.o misc/libvgamisc.a misc/fontdemo


g3vga: vgaui.o g3decode.o misc/libvgamisc.a

g3decode.o: help.h g3decode.c vgaui.h #Makefile

gifvga: vgaui.o  gif/gifvga.o gif/xvgif.o misc/libvgamisc.a
