2019-12-30  Juan Manuel Guerrero <juan.guerrero@gmx.de>

	* dos/pdcutil.c (PDC_napms): Use delay function for DJGPP specific
	implementation of PDC_napms.

	* dos/gccdos.mak: Add -O0 to the debug build.
	manual target added to produce PDCurses.txt.
	New variables prefix, includedir, libdir, docdir and mandir
	added to make it possible to install in standard places.
	library names changed to libpdcurses.a and libpanel.a.
	install target added to install the products in the right
	places of a standard DJGPP installation directory tree.






diff -aprNU5 PDCurses-3.9.orig/dos/Makefile PDCurses-3.9/dos/Makefile
--- PDCurses-3.9.orig/dos/Makefile	2019-09-04 20:08:02 +0000
+++ PDCurses-3.9/dos/Makefile	2019-12-30 15:19:26 +0000
@@ -1,15 +1,22 @@
 # GNU Makefile for PDCurses - DOS
 #
 # Usage: make [-f path\Makefile] [DEBUG=Y] [target]
 #
 # where target can be any of:
-# [all|libs|demos|pdcurses.a|testcurs.exe...]
+# [all|libs|demos|manual|dist|install|libpdcurses.a|testcurs.exe...]
+#
+# Target `install' will install the products in the standard places
+# for a stock DJGPP installation given by the value of the environment
+# variable DJDIR.
+# If the user prefers to install in some other directory, he must
+# supply a new value for the prefix variable at the command line
+# like this:
+#   make [-f path\Makefile] install prefix=/some/other/dir
 
 O = o
 E = .exe
-RM = del
 
 ifndef PDCURSES_SRCDIR
 	PDCURSES_SRCDIR = ..
 endif
 
@@ -17,14 +24,20 @@ include $(PDCURSES_SRCDIR)/common/libobj
 
 osdir		= $(PDCURSES_SRCDIR)/dos
 
 PDCURSES_DOS_H	= $(osdir)/pdcdos.h
 
+prefix		= /dev/env/DJDIR
+includedir	= $(prefix)/include
+libdir		= $(prefix)/lib
+docdir		= $(prefix)/contrib/PDCurses.39
+gnudocsdir	= $(prefix)/share/doc/PDCurses.39
+
 CC		= gcc
 
 ifeq ($(DEBUG),Y)
-	CFLAGS  = -g -Wall -DPDCDEBUG
+	CFLAGS  = -g -O0 -Wall -DPDCDEBUG
 	LDFLAGS = -g
 else
 	CFLAGS  = -O2 -Wall
 	LDFLAGS =
 endif
@@ -34,13 +47,19 @@ CFLAGS += -I$(PDCURSES_SRCDIR)
 LINK		= gcc
 
 LIBEXE		= ar
 LIBFLAGS	= rcv
 
-LIBCURSES	= pdcurses.a
+LIBCURSES	= libpdcurses.a
+LIBPANEL	= libpanel.a
 
-.PHONY: all libs clean demos dist
+CP		= /dev/env/DJDIR/bin/cp
+RM		= /dev/env/DJDIR/bin/rm
+STRIP		= /dev/env/DJDIR/bin/strip
+INSTALL		= /dev/env/DJDIR/bin/ginstall
+
+.PHONY: all libs clean demos dist install
 
 all:	libs
 
 libs:	$(LIBCURSES)
 
@@ -52,12 +71,30 @@ clean:
 demos:	$(DEMOS)
 ifneq ($(DEBUG),Y)
 	strip *.exe
 endif
 
+install: $(LIBCURSES)
+	$(INSTALL) -d $(includedir)
+	$(INSTALL) -d $(libdir)
+	$(INSTALL) -d $(docdir)
+	$(INSTALL) -d $(docdir)/dos
+	$(INSTALL) -d $(gnudocsdir)
+	$(INSTALL) $(PDCURSES_SRCDIR)/curses.h $(includedir)
+	$(INSTALL) $(PDCURSES_SRCDIR)/panel.h $(includedir)
+	$(INSTALL) $(LIBCURSES) $(libdir)
+	$(INSTALL) $(LIBPANEL) $(libdir)
+	$(INSTALL) $(PDCURSES_SRCDIR)/README.md $(docdir)/README
+	$(INSTALL) $(PDCURSES_SRCDIR)/dos/README.md $(docdir)/dos/README
+	$(INSTALL) $(PDCURSES_SRCDIR)/docs/HISTORY.md $(docdir)/HISTORY
+	$(INSTALL) $(PDCURSES_SRCDIR)/docs/IMPLEMNT.md $(docdir)/IMPLEMNT
+	$(INSTALL) $(PDCURSES_SRCDIR)/docs/MANUAL.md $(gnudocsdir)/manual.txt
+	$(INSTALL) $(PDCURSES_SRCDIR)/docs/USERS.md $(gnudocsdir)/users.txt
+
 $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
 	$(LIBEXE) $(LIBFLAGS) $@ $?
+	-$(CP) $(LIBCURSES) $(LIBPANEL)
 
 $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
 $(PDCOBJS) : $(PDCURSES_DOS_H)
 $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
 panel.o : $(PANEL_HEADER)
diff -aprNU5 PDCurses-3.9.orig/dos/pdcutil.c PDCurses-3.9/dos/pdcutil.c
--- PDCurses-3.9.orig/dos/pdcutil.c	2019-09-04 20:08:02 +0000
+++ PDCurses-3.9/dos/pdcutil.c	2019-12-30 15:18:12 +0000
@@ -13,15 +13,18 @@ void PDC_beep(void)
     PDCINT(0x10, regs);
 }
 
 void PDC_napms(int ms)
 {
+#ifndef __DJGPP__
     PDCREGS regs;
     long goal, start, current;
+#endif
 
     PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
 
+#ifndef __DJGPP__
     goal = DIVROUND((long)ms, 50);
     if (!goal)
         goal++;
 
     start = getdosmemdword(0x46c);
@@ -35,10 +38,15 @@ void PDC_napms(int ms)
 
         regs.W.ax = 0x1680;
         PDCINT(0x2f, regs);
         PDCINT(0x28, regs);
     }
+#else
+    /*  Does not work realiable with DJGPP;
+        prefer delay instead.  */
+    delay(ms);
+#endif
 }
 
 const char *PDC_sysname(void)
 {
     return "DOS";
