ver = 1.3.1
PRG = hpscat
OBJ = hpscat.o fillbuf.o init.o misc.o ps.o showbuf.o ps_idx.o user.o
SRC = $(OBJ:.o=.c)

# define if you have hangul PS printer 
#CFLAGS = -DHPS -O
CFLAGS = -O -O2 -O3 -O6
LDFLAGS = -s

DESTDIR = /usr/local/bin        # Where do you want to install "hpscat"? 
WhereIsGS = /usr/lib/ghostscript# Where is GhostScript Directory? 
FONTS = ./fonts
FONTSSTUB = $(FONTS)/Munjo $(FONTS)/MunjoBold $(FONTS)/PCMunjo \
	    $(FONTS)/Gotic $(FONTS)/Header 
ByDDAENG7 = $(FONTS)/ddaeng7

$(PRG): $(OBJ)
	$(CC) $(LDFLAGS) -o $@ $(OBJ)

clean:
	rm -f $(OBJ)

#dist: $(SRC)
#	tar cf - $(SRC) hpscat.h ps.h Makefile README | gzip > hpscat-${ver}.tgz

install: # You must have root permission at this point!!
	mv $(WhereIsGS)/gs_init.ps $(WhereIsGS)/gs_init.ps.orig
	cat $(WhereIsGS)/gs_init.ps.orig $(ByDDAENG7) > $(WhereIsGS)/gs_init.ps
	cp $(FONTSSTUB) $(WhereIsGS) 
	install -c -g bin -m 755 -o root -s $(PRG) $(DESTDIR)

fillbuf.o: hpscat.h
hpscat.o: hpscat.h
init.o: hpscat.h
misc.o: hpscat.h
ps.o: hpscat.h
showbuf.o: hpscat.h ps.h
user.o: hpscat.h
