Forráskód Böngészése

* exampleinstall target added

peter 25 éve
szülő
commit
8b38902424
100 módosított fájl, 5575 hozzáadás és 1936 törlés
  1. 103 13
      api/Makefile
  2. 4 2
      api/Makefile.fpc
  3. 87 63
      api/go32v2/Makefile
  4. 1 3
      api/go32v2/Makefile.fpc
  5. 43 26
      api/linux/Makefile
  6. 1 3
      api/linux/Makefile.fpc
  7. 3 5
      api/test/testfsys.pas
  8. 87 63
      api/win32/Makefile
  9. 1 3
      api/win32/Makefile.fpc
  10. 79 26
      base/Makefile
  11. 7 7
      base/Makefile.fpc
  12. 42 2
      compiler/Makefile
  13. 90 43
      compiler/new/Makefile
  14. 164 13
      fcl/Makefile
  15. 4 2
      fcl/Makefile.fpc
  16. 92 44
      fcl/db/Makefile
  17. 95 43
      fcl/db/interbase/Makefile
  18. 42 2
      fcl/go32v2/Makefile
  19. 42 2
      fcl/linux/Makefile
  20. 90 43
      fcl/os2/Makefile
  21. 80 33
      fcl/shedit/gtk/Makefile
  22. 85 38
      fcl/tests/Makefile
  23. 42 2
      fcl/win32/Makefile
  24. 29 8
      ide/Makefile
  25. 16 10
      ide/fake/Makefile
  26. 80 33
      ide/fake/compiler/Makefile
  27. 80 33
      ide/fake/gdb/Makefile
  28. 60 15
      ide/text/Makefile
  29. 4 3
      install/debian/control
  30. 1 5
      install/debian/fp-compiler.files.in
  31. 1 0
      install/debian/fp-units-api.files.in
  32. 1 0
      install/debian/fp-units-base.files.in
  33. 1 0
      install/debian/fp-units-db.files.in
  34. 1 0
      install/debian/fp-units-fcl.files.in
  35. 1 0
      install/debian/fp-units-gfx.files.in
  36. 1 2
      install/debian/fp-units-gtk.files.in
  37. 6 0
      install/debian/fp-units-misc.files.in
  38. 2 0
      install/debian/fp-units-net.files.in
  39. 2 0
      install/debian/fp-utils.files.in
  40. 12 4
      install/debian/rules
  41. 117 48
      install/demo/Makefile
  42. 1 6
      install/demo/Makefile.fpc
  43. 83 36
      install/demo/graph/Makefile
  44. 83 36
      install/demo/linux/Makefile
  45. 83 36
      install/demo/modex/Makefile
  46. 83 36
      install/demo/text/Makefile
  47. 83 36
      install/demo/win32/Makefile
  48. 14 9
      install/fpc-0.99.15.spec
  49. 83 36
      install/fpinst/Makefile
  50. 184 31
      packages/Makefile
  51. 1 0
      packages/Makefile.fpc
  52. 84 36
      packages/cmem/Makefile
  53. 2 3
      packages/cmem/Makefile.fpc
  54. 0 0
      packages/cmem/testcmem.pp
  55. 171 40
      packages/forms/Makefile
  56. 4 4
      packages/forms/Makefile.fpc
  57. 83 36
      packages/forms/demo/Makefile
  58. 97 48
      packages/gdbint/Makefile
  59. 3 0
      packages/gdbint/Makefile.fpc
  60. 1 1
      packages/gdbint/libgdb/Makefile
  61. 82 34
      packages/ggi/Makefile
  62. 134 30
      packages/gtk/Makefile
  63. 4 29
      packages/gtk/Makefile.fpc
  64. 169 53
      packages/gtk/examples/Makefile
  65. 1 0
      packages/gtk/examples/Makefile.fpc
  66. 82 34
      packages/ibase/Makefile
  67. 0 1
      packages/ibase/Makefile.fpc
  68. 82 34
      packages/inet/Makefile
  69. 0 1
      packages/inet/Makefile.fpc
  70. 82 34
      packages/mysql/Makefile
  71. 0 1
      packages/mysql/Makefile.fpc
  72. 83 34
      packages/ncurses/Makefile
  73. 3 1
      packages/ncurses/Makefile.fpc
  74. 855 71
      packages/opengl/Makefile
  75. 5 10
      packages/opengl/Makefile.fpc
  76. 80 33
      packages/opengl/build/Makefile
  77. 80 33
      packages/opengl/build2/Makefile
  78. 83 36
      packages/opengl/examples/Makefile
  79. 80 33
      packages/opengl/linux/Makefile
  80. 83 34
      packages/paszlib/Makefile
  81. 1 1
      packages/paszlib/Makefile.fpc
  82. 3 3
      packages/paszlib/example.pas
  83. 83 35
      packages/postgres/Makefile
  84. 1 1
      packages/postgres/Makefile.fpc
  85. 0 0
      packages/postgres/testpg1.pp
  86. 0 0
      packages/postgres/testpg2.pp
  87. 83 35
      packages/regexpr/Makefile
  88. 1 4
      packages/regexpr/Makefile.fpc
  89. 82 34
      packages/svgalib/Makefile
  90. 82 34
      packages/syslog/Makefile
  91. 1 4
      packages/syslog/Makefile.fpc
  92. 82 34
      packages/uncgi/Makefile
  93. 0 3
      packages/uncgi/Makefile.fpc
  94. 84 36
      packages/utmp/Makefile
  95. 2 3
      packages/utmp/Makefile.fpc
  96. 0 0
      packages/utmp/testutmp.pp
  97. 80 33
      packages/x11/Makefile
  98. 80 34
      packages/zip/Makefile
  99. 0 1
      packages/zip/Makefile.fpc
  100. 80 33
      packages/zlib/Makefile

+ 103 - 13
api/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -159,13 +159,15 @@ endif
 
 # Targets
 
-override DIROBJECTS+=$(wildcard go32v2 linux win32 os2 test)
+override DIROBJECTS+=$(wildcard go32v2 linux win32 os2)
+override EXAMPLEDIROBJECTS+=test
 
 # Clean
 
 
 # Install
 
+EXAMPLESUBDIR=api
 PACKAGENAME=api
 ZIPTARGET=install
 
@@ -404,6 +406,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -434,9 +449,9 @@ all: $(addsuffix _all,$(OS_TARGET))
 
 debug: $(addsuffix _debug,$(OS_TARGET))
 
-examples: $(addsuffix _examples,$(OS_TARGET))
+examples: fpc_examples
 
-test: $(addsuffix _test,$(OS_TARGET))
+test: fpc_test
 
 smart: $(addsuffix _smart,$(OS_TARGET))
 
@@ -448,11 +463,15 @@ install: $(addsuffix _install,$(OS_TARGET))
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
-clean: $(addsuffix _clean,$(OS_TARGET))
+zipexampleinstall: fpc_zipexampleinstall
+
+clean: $(addsuffix _clean,$(OS_TARGET)) $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
 
 distclean: $(addsuffix _distclean,$(OS_TARGET))
 
@@ -460,7 +479,25 @@ cleanall: $(addsuffix _cleanall,$(OS_TARGET))
 
 require: $(addsuffix _require,$(OS_TARGET))
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require
+
+#####################################################################
+# Examples
+#####################################################################
+
+.PHONY: fpc_examples fpc_test
+
+ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
+
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+endif
+
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
+
+fpc_test: examples
 
 #####################################################################
 # SourceInstall rules
@@ -476,6 +513,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -537,6 +592,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Directories
 #####################################################################
@@ -545,12 +605,11 @@ OBJECTDIRGO32V2=1
 OBJECTDIRLINUX=1
 OBJECTDIRWIN32=1
 OBJECTDIROS2=1
-OBJECTDIRTEST=1
 
 # Dir go32v2
 
 ifdef OBJECTDIRGO32V2
-.PHONY:  go32v2_all go32v2_debug go32v2_examples go32v2_test go32v2_smart go32v2_shared go32v2_showinstall go32v2_install go32v2_sourceinstall go32v2_zipinstall go32v2_zipsourceinstall go32v2_clean go32v2_distclean go32v2_cleanall go32v2_require go32v2_info
+.PHONY:  go32v2_all go32v2_debug go32v2_examples go32v2_test go32v2_smart go32v2_shared go32v2_showinstall go32v2_install go32v2_sourceinstall go32v2_exampleinstall go32v2_zipinstall go32v2_zipsourceinstall go32v2_zipexampleinstall go32v2_clean go32v2_distclean go32v2_cleanall go32v2_require go32v2_info
 
 go32v2_all:
 	$(MAKE) -C go32v2 all
@@ -579,12 +638,18 @@ go32v2_install:
 go32v2_sourceinstall:
 	$(MAKE) -C go32v2 sourceinstall
 
+go32v2_exampleinstall:
+	$(MAKE) -C go32v2 exampleinstall
+
 go32v2_zipinstall:
 	$(MAKE) -C go32v2 zipinstall
 
 go32v2_zipsourceinstall:
 	$(MAKE) -C go32v2 zipsourceinstall
 
+go32v2_zipexampleinstall:
+	$(MAKE) -C go32v2 zipexampleinstall
+
 go32v2_clean:
 	$(MAKE) -C go32v2 clean
 
@@ -604,7 +669,7 @@ endif
 # Dir linux
 
 ifdef OBJECTDIRLINUX
-.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_zipinstall linux_zipsourceinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
+.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_exampleinstall linux_zipinstall linux_zipsourceinstall linux_zipexampleinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
 
 linux_all:
 	$(MAKE) -C linux all
@@ -633,12 +698,18 @@ linux_install:
 linux_sourceinstall:
 	$(MAKE) -C linux sourceinstall
 
+linux_exampleinstall:
+	$(MAKE) -C linux exampleinstall
+
 linux_zipinstall:
 	$(MAKE) -C linux zipinstall
 
 linux_zipsourceinstall:
 	$(MAKE) -C linux zipsourceinstall
 
+linux_zipexampleinstall:
+	$(MAKE) -C linux zipexampleinstall
+
 linux_clean:
 	$(MAKE) -C linux clean
 
@@ -658,7 +729,7 @@ endif
 # Dir win32
 
 ifdef OBJECTDIRWIN32
-.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_zipinstall win32_zipsourceinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
+.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_exampleinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
 
 win32_all:
 	$(MAKE) -C win32 all
@@ -687,12 +758,18 @@ win32_install:
 win32_sourceinstall:
 	$(MAKE) -C win32 sourceinstall
 
+win32_exampleinstall:
+	$(MAKE) -C win32 exampleinstall
+
 win32_zipinstall:
 	$(MAKE) -C win32 zipinstall
 
 win32_zipsourceinstall:
 	$(MAKE) -C win32 zipsourceinstall
 
+win32_zipexampleinstall:
+	$(MAKE) -C win32 zipexampleinstall
+
 win32_clean:
 	$(MAKE) -C win32 clean
 
@@ -712,7 +789,7 @@ endif
 # Dir os2
 
 ifdef OBJECTDIROS2
-.PHONY:  os2_all os2_debug os2_examples os2_test os2_smart os2_shared os2_showinstall os2_install os2_sourceinstall os2_zipinstall os2_zipsourceinstall os2_clean os2_distclean os2_cleanall os2_require os2_info
+.PHONY:  os2_all os2_debug os2_examples os2_test os2_smart os2_shared os2_showinstall os2_install os2_sourceinstall os2_exampleinstall os2_zipinstall os2_zipsourceinstall os2_zipexampleinstall os2_clean os2_distclean os2_cleanall os2_require os2_info
 
 os2_all:
 	$(MAKE) -C os2 all
@@ -741,12 +818,18 @@ os2_install:
 os2_sourceinstall:
 	$(MAKE) -C os2 sourceinstall
 
+os2_exampleinstall:
+	$(MAKE) -C os2 exampleinstall
+
 os2_zipinstall:
 	$(MAKE) -C os2 zipinstall
 
 os2_zipsourceinstall:
 	$(MAKE) -C os2 zipsourceinstall
 
+os2_zipexampleinstall:
+	$(MAKE) -C os2 zipexampleinstall
+
 os2_clean:
 	$(MAKE) -C os2 clean
 
@@ -762,11 +845,12 @@ os2_require:
 os2_info:
 	$(MAKE) -C os2 info
 endif
+EXAMPLEDIRTEST=1
 
 # Dir test
 
-ifdef OBJECTDIRTEST
-.PHONY:  test_all test_debug test_examples test_test test_smart test_shared test_showinstall test_install test_sourceinstall test_zipinstall test_zipsourceinstall test_clean test_distclean test_cleanall test_require test_info
+ifdef EXAMPLEDIRTEST
+.PHONY:  test_all test_debug test_examples test_test test_smart test_shared test_showinstall test_install test_sourceinstall test_exampleinstall test_zipinstall test_zipsourceinstall test_zipexampleinstall test_clean test_distclean test_cleanall test_require test_info
 
 test_all:
 	$(MAKE) -C test all
@@ -795,12 +879,18 @@ test_install:
 test_sourceinstall:
 	$(MAKE) -C test sourceinstall
 
+test_exampleinstall:
+	$(MAKE) -C test exampleinstall
+
 test_zipinstall:
 	$(MAKE) -C test zipinstall
 
 test_zipsourceinstall:
 	$(MAKE) -C test zipsourceinstall
 
+test_zipexampleinstall:
+	$(MAKE) -C test zipexampleinstall
+
 test_clean:
 	$(MAKE) -C test clean
 

+ 4 - 2
api/Makefile.fpc

@@ -3,15 +3,17 @@
 #
 
 [targets]
-dirs=go32v2 linux win32 os2 test
+dirs=go32v2 linux win32 os2
+exampledirs=test
 
 [defaults]
 defaultdir=$(OS_TARGET)
 
 [install]
 packagename=api
-sourcesubdirs=0
+examplesubdir=api
 
 [sections]
 none=1
 zipsourceinstall=1
+zipexampleinstall=1

+ 87 - 63
api/go32v2/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -128,7 +128,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 #####################################################################
 # FPCDIR Setting
@@ -202,7 +201,6 @@ endif
 # Targets
 
 override UNITOBJECTS+=$(APIOBJECTS) vesamode
-override EXAMPLEOBJECTS+=$(TESTOBJECTS)
 
 # Clean
 
@@ -218,7 +216,7 @@ ZIPTARGET=install
 
 # Directories
 
-vpath %$(PASEXT) $(INC) ../test
+vpath %$(PASEXT) $(INC)
 override NEEDINCDIR=$(INC)
 ifndef TARGETDIR
 TARGETDIR=.
@@ -634,6 +632,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -669,22 +680,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -727,21 +734,27 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef NEEDINCDIR
+override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -784,10 +797,6 @@ all: fpc_all
 
 debug: fpc_debug
 
-examples: fpc_examples
-
-test: fpc_test
-
 smart: fpc_smart
 
 shared: fpc_shared
@@ -798,10 +807,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -810,7 +823,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -826,23 +839,6 @@ override CLEANPPUFILES+=$(UNITPPUFILES)
 
 fpc_units: $(UNITPPUFILES)
 
-#####################################################################
-# Examples
-#####################################################################
-
-.PHONY: fpc_examples fpc_test
-
-ifdef EXAMPLEOBJECTS
-override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
-override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
-
-override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
-endif
-
-fpc_examples: all $(EXAMPLEFILES)
-
-fpc_test: examples
-
 #####################################################################
 # General compile rules
 #####################################################################
@@ -885,6 +881,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -898,7 +900,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -916,14 +918,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -938,8 +933,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -962,9 +960,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -986,6 +987,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1047,6 +1066,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1082,7 +1106,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 3
api/go32v2/Makefile.fpc

@@ -7,7 +7,6 @@ defaulttarget=go32v2
 
 [targets]
 units=$(APIOBJECTS) vesamode
-examples=$(TESTOBJECTS)
 
 [install]
 unitsubdir=api
@@ -19,7 +18,7 @@ libname=fpapi
 [dirs]
 fpcdir=../..
 targetdir=.
-sourcesdir=$(INC) ../test
+sourcesdir=$(INC)
 incdir=$(INC)
 
 [presettings]
@@ -28,7 +27,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 
 

+ 43 - 26
api/linux/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/03]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -128,7 +128,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 #####################################################################
 # FPCDIR Setting
@@ -202,7 +201,6 @@ endif
 # Targets
 
 override UNITOBJECTS+=terminfo $(APIOBJECTS)
-override EXAMPLEOBJECTS+=$(TESTOBJECTS)
 
 # Clean
 
@@ -218,7 +216,7 @@ ZIPTARGET=install
 
 # Directories
 
-vpath %$(PASEXT) $(INC) ../test
+vpath %$(PASEXT) $(INC)
 override NEEDINCDIR=$(INC)
 ifndef TARGETDIR
 TARGETDIR=.
@@ -635,6 +633,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -787,10 +798,6 @@ all: fpc_all
 
 debug: fpc_debug
 
-examples: fpc_examples
-
-test: fpc_test
-
 smart: fpc_smart
 
 shared: fpc_shared
@@ -801,10 +808,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -813,7 +824,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -829,23 +840,6 @@ override CLEANPPUFILES+=$(UNITPPUFILES)
 
 fpc_units: $(UNITPPUFILES)
 
-#####################################################################
-# Examples
-#####################################################################
-
-.PHONY: fpc_examples fpc_test
-
-ifdef EXAMPLEOBJECTS
-override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
-override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
-
-override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
-endif
-
-fpc_examples: all $(EXAMPLEFILES)
-
-fpc_test: examples
-
 #####################################################################
 # General compile rules
 #####################################################################
@@ -994,6 +988,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1055,6 +1067,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################

+ 1 - 3
api/linux/Makefile.fpc

@@ -7,7 +7,6 @@ defaulttarget=linux
 
 [targets]
 units=terminfo $(APIOBJECTS)
-examples=$(TESTOBJECTS)
 
 [install]
 unitsubdir=api
@@ -20,7 +19,7 @@ libversion=1.0
 [dirs]
 fpcdir=../..
 targetdir=.
-sourcesdir=$(INC) ../test
+sourcesdir=$(INC)
 incdir=$(INC)
 
 [presettings]
@@ -29,7 +28,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 
 

+ 3 - 5
api/test/testfsys.pas

@@ -3,8 +3,6 @@
   it will be deleted ! }
 program TestFS;
 
-{$I platform.inc}
-
 uses
   ApiComm,
   Filesys;
@@ -117,10 +115,10 @@ begin
         end;
      11 :
         begin
-          {$ifdef OS_DOS}
-          n := 'c:\sub1\sub3.ext.ext\name.gz';
-          {$ELSE}
+          {$ifdef linux}
           n := '/sub1/sub3.ext.ext/name.gz';
+          {$ELSE}
+          n := 'c:\sub1\sub3.ext.ext\name.gz';
           {$endif}
           SplitName (n, p, rn, e);
           Write ('"', n, '" => ',

+ 87 - 63
api/win32/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -128,7 +128,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 #####################################################################
 # FPCDIR Setting
@@ -202,7 +201,6 @@ endif
 # Targets
 
 override UNITOBJECTS+=event $(APIOBJECTS)
-override EXAMPLEOBJECTS+=$(TESTOBJECTS)
 
 # Clean
 
@@ -218,7 +216,7 @@ ZIPTARGET=install
 
 # Directories
 
-vpath %$(PASEXT) $(INC) ../test
+vpath %$(PASEXT) $(INC)
 override NEEDINCDIR=$(INC)
 ifndef TARGETDIR
 TARGETDIR=.
@@ -634,6 +632,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -669,22 +680,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -727,21 +734,27 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef NEEDINCDIR
+override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -784,10 +797,6 @@ all: fpc_all
 
 debug: fpc_debug
 
-examples: fpc_examples
-
-test: fpc_test
-
 smart: fpc_smart
 
 shared: fpc_shared
@@ -798,10 +807,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -810,7 +823,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -826,23 +839,6 @@ override CLEANPPUFILES+=$(UNITPPUFILES)
 
 fpc_units: $(UNITPPUFILES)
 
-#####################################################################
-# Examples
-#####################################################################
-
-.PHONY: fpc_examples fpc_test
-
-ifdef EXAMPLEOBJECTS
-override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
-override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
-
-override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
-endif
-
-fpc_examples: all $(EXAMPLEFILES)
-
-fpc_test: examples
-
 #####################################################################
 # General compile rules
 #####################################################################
@@ -885,6 +881,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -898,7 +900,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -916,14 +918,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -938,8 +933,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -962,9 +960,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -986,6 +987,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1047,6 +1066,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1082,7 +1106,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 3
api/win32/Makefile.fpc

@@ -7,7 +7,6 @@ defaulttarget=win32
 
 [targets]
 units=event $(APIOBJECTS)
-examples=$(TESTOBJECTS)
 
 [install]
 unitsubdir=api
@@ -19,7 +18,7 @@ libname=fpapi
 [dirs]
 fpcdir=../..
 targetdir=.
-sourcesdir=$(INC) ../test
+sourcesdir=$(INC)
 incdir=$(INC)
 
 [presettings]
@@ -28,7 +27,6 @@ INC=../inc
 # Override defaults
 override PASEXT=.pas
 
-include ../test/Makefile.api
 include $(INC)/Makefile.api
 
 

+ 79 - 26
base/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: help
@@ -646,6 +646,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -674,25 +687,17 @@ endif
 
 debug: $(addsuffix _debug,$(DIROBJECTS))
 
-examples: $(addsuffix _examples,$(DIROBJECTS))
-
-test: $(addsuffix _test,$(DIROBJECTS))
-
 smart: $(addsuffix _smart,$(DIROBJECTS))
 
 shared: $(addsuffix _shared,$(DIROBJECTS))
 
 showinstall: $(addsuffix _showinstall,$(DIROBJECTS))
 
-sourceinstall: $(addsuffix _sourceinstall,$(DIROBJECTS))
-
-zipsourceinstall: fpc_zipsourceinstall
-
 cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS))
 
 require: $(addsuffix _require,$(DIROBJECTS))
 
-.PHONY:  debug examples test smart shared showinstall sourceinstall zipsourceinstall cleanall require
+.PHONY:  debug smart shared showinstall cleanall require
 
 #####################################################################
 # Zip
@@ -785,7 +790,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -815,7 +820,7 @@ OBJECTDIRIDE=1
 # Dir compiler
 
 ifdef OBJECTDIRCOMPILER
-.PHONY:  compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_zipinstall compiler_zipsourceinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
+.PHONY:  compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_exampleinstall compiler_zipinstall compiler_zipsourceinstall compiler_zipexampleinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
 
 compiler_all:
 	$(MAKE) -C compiler all
@@ -844,12 +849,18 @@ compiler_install:
 compiler_sourceinstall:
 	$(MAKE) -C compiler sourceinstall
 
+compiler_exampleinstall:
+	$(MAKE) -C compiler exampleinstall
+
 compiler_zipinstall:
 	$(MAKE) -C compiler zipinstall
 
 compiler_zipsourceinstall:
 	$(MAKE) -C compiler zipsourceinstall
 
+compiler_zipexampleinstall:
+	$(MAKE) -C compiler zipexampleinstall
+
 compiler_clean:
 	$(MAKE) -C compiler clean
 
@@ -869,7 +880,7 @@ endif
 # Dir rtl
 
 ifdef OBJECTDIRRTL
-.PHONY:  rtl_all rtl_debug rtl_examples rtl_test rtl_smart rtl_shared rtl_showinstall rtl_install rtl_sourceinstall rtl_zipinstall rtl_zipsourceinstall rtl_clean rtl_distclean rtl_cleanall rtl_require rtl_info
+.PHONY:  rtl_all rtl_debug rtl_examples rtl_test rtl_smart rtl_shared rtl_showinstall rtl_install rtl_sourceinstall rtl_exampleinstall rtl_zipinstall rtl_zipsourceinstall rtl_zipexampleinstall rtl_clean rtl_distclean rtl_cleanall rtl_require rtl_info
 
 rtl_all:
 	$(MAKE) -C rtl all
@@ -898,12 +909,18 @@ rtl_install:
 rtl_sourceinstall:
 	$(MAKE) -C rtl sourceinstall
 
+rtl_exampleinstall:
+	$(MAKE) -C rtl exampleinstall
+
 rtl_zipinstall:
 	$(MAKE) -C rtl zipinstall
 
 rtl_zipsourceinstall:
 	$(MAKE) -C rtl zipsourceinstall
 
+rtl_zipexampleinstall:
+	$(MAKE) -C rtl zipexampleinstall
+
 rtl_clean:
 	$(MAKE) -C rtl clean
 
@@ -923,7 +940,7 @@ endif
 # Dir utils
 
 ifdef OBJECTDIRUTILS
-.PHONY:  utils_all utils_debug utils_examples utils_test utils_smart utils_shared utils_showinstall utils_install utils_sourceinstall utils_zipinstall utils_zipsourceinstall utils_clean utils_distclean utils_cleanall utils_require utils_info
+.PHONY:  utils_all utils_debug utils_examples utils_test utils_smart utils_shared utils_showinstall utils_install utils_sourceinstall utils_exampleinstall utils_zipinstall utils_zipsourceinstall utils_zipexampleinstall utils_clean utils_distclean utils_cleanall utils_require utils_info
 
 utils_all:
 	$(MAKE) -C utils all
@@ -952,12 +969,18 @@ utils_install:
 utils_sourceinstall:
 	$(MAKE) -C utils sourceinstall
 
+utils_exampleinstall:
+	$(MAKE) -C utils exampleinstall
+
 utils_zipinstall:
 	$(MAKE) -C utils zipinstall
 
 utils_zipsourceinstall:
 	$(MAKE) -C utils zipsourceinstall
 
+utils_zipexampleinstall:
+	$(MAKE) -C utils zipexampleinstall
+
 utils_clean:
 	$(MAKE) -C utils clean
 
@@ -977,7 +1000,7 @@ endif
 # Dir fcl
 
 ifdef OBJECTDIRFCL
-.PHONY:  fcl_all fcl_debug fcl_examples fcl_test fcl_smart fcl_shared fcl_showinstall fcl_install fcl_sourceinstall fcl_zipinstall fcl_zipsourceinstall fcl_clean fcl_distclean fcl_cleanall fcl_require fcl_info
+.PHONY:  fcl_all fcl_debug fcl_examples fcl_test fcl_smart fcl_shared fcl_showinstall fcl_install fcl_sourceinstall fcl_exampleinstall fcl_zipinstall fcl_zipsourceinstall fcl_zipexampleinstall fcl_clean fcl_distclean fcl_cleanall fcl_require fcl_info
 
 fcl_all:
 	$(MAKE) -C fcl all
@@ -1006,12 +1029,18 @@ fcl_install:
 fcl_sourceinstall:
 	$(MAKE) -C fcl sourceinstall
 
+fcl_exampleinstall:
+	$(MAKE) -C fcl exampleinstall
+
 fcl_zipinstall:
 	$(MAKE) -C fcl zipinstall
 
 fcl_zipsourceinstall:
 	$(MAKE) -C fcl zipsourceinstall
 
+fcl_zipexampleinstall:
+	$(MAKE) -C fcl zipexampleinstall
+
 fcl_clean:
 	$(MAKE) -C fcl clean
 
@@ -1031,7 +1060,7 @@ endif
 # Dir api
 
 ifdef OBJECTDIRAPI
-.PHONY:  api_all api_debug api_examples api_test api_smart api_shared api_showinstall api_install api_sourceinstall api_zipinstall api_zipsourceinstall api_clean api_distclean api_cleanall api_require api_info
+.PHONY:  api_all api_debug api_examples api_test api_smart api_shared api_showinstall api_install api_sourceinstall api_exampleinstall api_zipinstall api_zipsourceinstall api_zipexampleinstall api_clean api_distclean api_cleanall api_require api_info
 
 api_all:
 	$(MAKE) -C api all
@@ -1060,12 +1089,18 @@ api_install:
 api_sourceinstall:
 	$(MAKE) -C api sourceinstall
 
+api_exampleinstall:
+	$(MAKE) -C api exampleinstall
+
 api_zipinstall:
 	$(MAKE) -C api zipinstall
 
 api_zipsourceinstall:
 	$(MAKE) -C api zipsourceinstall
 
+api_zipexampleinstall:
+	$(MAKE) -C api zipexampleinstall
+
 api_clean:
 	$(MAKE) -C api clean
 
@@ -1085,7 +1120,7 @@ endif
 # Dir fv
 
 ifdef OBJECTDIRFV
-.PHONY:  fv_all fv_debug fv_examples fv_test fv_smart fv_shared fv_showinstall fv_install fv_sourceinstall fv_zipinstall fv_zipsourceinstall fv_clean fv_distclean fv_cleanall fv_require fv_info
+.PHONY:  fv_all fv_debug fv_examples fv_test fv_smart fv_shared fv_showinstall fv_install fv_sourceinstall fv_exampleinstall fv_zipinstall fv_zipsourceinstall fv_zipexampleinstall fv_clean fv_distclean fv_cleanall fv_require fv_info
 
 fv_all:
 	$(MAKE) -C fv all
@@ -1114,12 +1149,18 @@ fv_install:
 fv_sourceinstall:
 	$(MAKE) -C fv sourceinstall
 
+fv_exampleinstall:
+	$(MAKE) -C fv exampleinstall
+
 fv_zipinstall:
 	$(MAKE) -C fv zipinstall
 
 fv_zipsourceinstall:
 	$(MAKE) -C fv zipsourceinstall
 
+fv_zipexampleinstall:
+	$(MAKE) -C fv zipexampleinstall
+
 fv_clean:
 	$(MAKE) -C fv clean
 
@@ -1139,7 +1180,7 @@ endif
 # Dir packages
 
 ifdef OBJECTDIRPACKAGES
-.PHONY:  packages_all packages_debug packages_examples packages_test packages_smart packages_shared packages_showinstall packages_install packages_sourceinstall packages_zipinstall packages_zipsourceinstall packages_clean packages_distclean packages_cleanall packages_require packages_info
+.PHONY:  packages_all packages_debug packages_examples packages_test packages_smart packages_shared packages_showinstall packages_install packages_sourceinstall packages_exampleinstall packages_zipinstall packages_zipsourceinstall packages_zipexampleinstall packages_clean packages_distclean packages_cleanall packages_require packages_info
 
 packages_all:
 	$(MAKE) -C packages all
@@ -1168,12 +1209,18 @@ packages_install:
 packages_sourceinstall:
 	$(MAKE) -C packages sourceinstall
 
+packages_exampleinstall:
+	$(MAKE) -C packages exampleinstall
+
 packages_zipinstall:
 	$(MAKE) -C packages zipinstall
 
 packages_zipsourceinstall:
 	$(MAKE) -C packages zipsourceinstall
 
+packages_zipexampleinstall:
+	$(MAKE) -C packages zipexampleinstall
+
 packages_clean:
 	$(MAKE) -C packages clean
 
@@ -1193,7 +1240,7 @@ endif
 # Dir ide
 
 ifdef OBJECTDIRIDE
-.PHONY:  ide_all ide_debug ide_examples ide_test ide_smart ide_shared ide_showinstall ide_install ide_sourceinstall ide_zipinstall ide_zipsourceinstall ide_clean ide_distclean ide_cleanall ide_require ide_info
+.PHONY:  ide_all ide_debug ide_examples ide_test ide_smart ide_shared ide_showinstall ide_install ide_sourceinstall ide_exampleinstall ide_zipinstall ide_zipsourceinstall ide_zipexampleinstall ide_clean ide_distclean ide_cleanall ide_require ide_info
 
 ide_all:
 	$(MAKE) -C ide all
@@ -1222,12 +1269,18 @@ ide_install:
 ide_sourceinstall:
 	$(MAKE) -C ide sourceinstall
 
+ide_exampleinstall:
+	$(MAKE) -C ide exampleinstall
+
 ide_zipinstall:
 	$(MAKE) -C ide zipinstall
 
 ide_zipsourceinstall:
 	$(MAKE) -C ide zipsourceinstall
 
+ide_zipexampleinstall:
+	$(MAKE) -C ide zipexampleinstall
+
 ide_clean:
 	$(MAKE) -C ide clean
 
@@ -1388,13 +1441,13 @@ export RELEASE DESTZIPDIR
 all: build
 
 clean: $(addsuffix _distclean,$(DIROBJECTS))
-	$(DEL) build-stamp
+	$(DEL) build-stamp.*
 
 distclean: clean
 
 
-build: build-stamp
-build-stamp:
+build: build-stamp.$(OS_TARGET)
+build-stamp.$(OS_TARGET):
 # create new compiler
 ifeq ($(OS_TARGET),win32)
 	-$(MAKE) compiler_cycle
@@ -1420,9 +1473,9 @@ endif
 ifdef IDE
 	-$(MAKE) ide_full $(BUILDOPTS)
 endif
-	$(ECHO) Build > build-stamp
+	$(ECHO) Build > build-stamp.$(OS_TARGET)
 
-installbase: build-stamp
+installbase: build-stamp.$(OS_TARGET)
 # create dirs
 	$(MKDIR) $(BASEINSTALLDIR)
 	$(MKDIR) $(DOCINSTALLDIR)
@@ -1447,7 +1500,7 @@ endif
 	$(MAKE) compiler_install $(INSTALLOPTS)
 	$(MAKE) rtl_install $(INSTALLOPTS)
 
-install: build-stamp
+install: build-stamp.$(OS_TARGET)
 	$(MAKE) installbase $(INSTALLOPTS)
 	$(MAKE) utils_install $(INSTALLOPTS)
 	$(MAKE) api_install $(INSTALLOPTS)
@@ -1457,7 +1510,7 @@ ifdef IDE
 	$(NOSTOP)$(MAKE) ide_install $(BUILDOPTS)
 endif
 
-zipinstall: build-stamp
+zipinstall: build-stamp.$(OS_TARGET)
 	$(MAKE) fpc_zipinstall ZIPTARGET=installbase PACKAGENAME=base $(INSTALLOPTS)
 	$(MAKE) utils_zipinstall $(INSTALLOPTS)
 	$(MAKE) api_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)

+ 7 - 7
base/Makefile.fpc

@@ -260,13 +260,13 @@ export RELEASE DESTZIPDIR
 all: build
 
 clean: $(addsuffix _distclean,$(DIROBJECTS))
-        $(DEL) build-stamp
+        $(DEL) build-stamp.*
 
 distclean: clean
 
 
-build: build-stamp
-build-stamp:
+build: build-stamp.$(OS_TARGET)
+build-stamp.$(OS_TARGET):
 # create new compiler
 ifeq ($(OS_TARGET),win32)
         -$(MAKE) compiler_cycle
@@ -292,9 +292,9 @@ endif
 ifdef IDE
         -$(MAKE) ide_full $(BUILDOPTS)
 endif
-        $(ECHO) Build > build-stamp
+        $(ECHO) Build > build-stamp.$(OS_TARGET)
 
-installbase: build-stamp
+installbase: build-stamp.$(OS_TARGET)
 # create dirs
         $(MKDIR) $(BASEINSTALLDIR)
         $(MKDIR) $(DOCINSTALLDIR)
@@ -319,7 +319,7 @@ endif
         $(MAKE) compiler_install $(INSTALLOPTS)
         $(MAKE) rtl_install $(INSTALLOPTS)
 
-install: build-stamp
+install: build-stamp.$(OS_TARGET)
         $(MAKE) installbase $(INSTALLOPTS)
         $(MAKE) utils_install $(INSTALLOPTS)
         $(MAKE) api_install $(INSTALLOPTS)
@@ -329,7 +329,7 @@ ifdef IDE
         $(NOSTOP)$(MAKE) ide_install $(BUILDOPTS)
 endif
 
-zipinstall: build-stamp
+zipinstall: build-stamp.$(OS_TARGET)
         $(MAKE) fpc_zipinstall ZIPTARGET=installbase PACKAGENAME=base $(INSTALLOPTS)
         $(MAKE) utils_zipinstall $(INSTALLOPTS)
         $(MAKE) api_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)

+ 42 - 2
compiler/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/16]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -729,6 +729,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -886,15 +899,19 @@ showinstall: fpc_showinstall
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  debug smart shared showinstall sourceinstall zipinstall zipsourceinstall cleanall info
+.PHONY:  debug smart shared showinstall sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall cleanall info
 
 #####################################################################
 # General compile rules
@@ -1044,6 +1061,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1105,6 +1140,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################

+ 90 - 43
compiler/new/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -748,6 +748,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -783,26 +796,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDOPT
-override FPCOPT+=$(NEEDOPT)
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -845,21 +850,31 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef NEEDINCDIR
+override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -908,15 +923,19 @@ showinstall: fpc_showinstall
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  debug smart shared showinstall sourceinstall zipinstall zipsourceinstall cleanall info
+.PHONY:  debug smart shared showinstall sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall cleanall info
 
 #####################################################################
 # General compile rules
@@ -960,6 +979,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -973,7 +998,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -991,14 +1016,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -1013,8 +1031,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1037,9 +1058,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1061,6 +1085,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1122,6 +1164,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1157,7 +1204,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 164 - 13
fcl/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -159,13 +159,15 @@ endif
 
 # Targets
 
-override DIROBJECTS+=$(wildcard go32v2 linux win32 os2 tests)
+override DIROBJECTS+=$(wildcard go32v2 linux win32 os2)
+override EXAMPLEDIROBJECTS+=tests shedit/gtk
 
 # Clean
 
 
 # Install
 
+EXAMPLESUBDIR=fcl
 PACKAGENAME=fcl
 ZIPTARGET=install
 
@@ -404,6 +406,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -434,9 +449,9 @@ all: $(addsuffix _all,$(OS_TARGET))
 
 debug: $(addsuffix _debug,$(OS_TARGET))
 
-examples: $(addsuffix _examples,$(OS_TARGET))
+examples: fpc_examples
 
-test: $(addsuffix _test,$(OS_TARGET))
+test: fpc_test
 
 smart: $(addsuffix _smart,$(OS_TARGET))
 
@@ -448,11 +463,15 @@ install: $(addsuffix _install,$(OS_TARGET))
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
-clean: $(addsuffix _clean,$(OS_TARGET))
+zipexampleinstall: fpc_zipexampleinstall
+
+clean: $(addsuffix _clean,$(OS_TARGET)) $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
 
 distclean: $(addsuffix _distclean,$(OS_TARGET))
 
@@ -460,7 +479,25 @@ cleanall: $(addsuffix _cleanall,$(OS_TARGET))
 
 require: $(addsuffix _require,$(OS_TARGET))
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require
+
+#####################################################################
+# Examples
+#####################################################################
+
+.PHONY: fpc_examples fpc_test
+
+ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
+
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+endif
+
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
+
+fpc_test: examples
 
 #####################################################################
 # SourceInstall rules
@@ -476,6 +513,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -537,6 +592,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Directories
 #####################################################################
@@ -545,12 +605,11 @@ OBJECTDIRGO32V2=1
 OBJECTDIRLINUX=1
 OBJECTDIRWIN32=1
 OBJECTDIROS2=1
-OBJECTDIRTESTS=1
 
 # Dir go32v2
 
 ifdef OBJECTDIRGO32V2
-.PHONY:  go32v2_all go32v2_debug go32v2_examples go32v2_test go32v2_smart go32v2_shared go32v2_showinstall go32v2_install go32v2_sourceinstall go32v2_zipinstall go32v2_zipsourceinstall go32v2_clean go32v2_distclean go32v2_cleanall go32v2_require go32v2_info
+.PHONY:  go32v2_all go32v2_debug go32v2_examples go32v2_test go32v2_smart go32v2_shared go32v2_showinstall go32v2_install go32v2_sourceinstall go32v2_exampleinstall go32v2_zipinstall go32v2_zipsourceinstall go32v2_zipexampleinstall go32v2_clean go32v2_distclean go32v2_cleanall go32v2_require go32v2_info
 
 go32v2_all:
 	$(MAKE) -C go32v2 all
@@ -579,12 +638,18 @@ go32v2_install:
 go32v2_sourceinstall:
 	$(MAKE) -C go32v2 sourceinstall
 
+go32v2_exampleinstall:
+	$(MAKE) -C go32v2 exampleinstall
+
 go32v2_zipinstall:
 	$(MAKE) -C go32v2 zipinstall
 
 go32v2_zipsourceinstall:
 	$(MAKE) -C go32v2 zipsourceinstall
 
+go32v2_zipexampleinstall:
+	$(MAKE) -C go32v2 zipexampleinstall
+
 go32v2_clean:
 	$(MAKE) -C go32v2 clean
 
@@ -604,7 +669,7 @@ endif
 # Dir linux
 
 ifdef OBJECTDIRLINUX
-.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_zipinstall linux_zipsourceinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
+.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_exampleinstall linux_zipinstall linux_zipsourceinstall linux_zipexampleinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
 
 linux_all:
 	$(MAKE) -C linux all
@@ -633,12 +698,18 @@ linux_install:
 linux_sourceinstall:
 	$(MAKE) -C linux sourceinstall
 
+linux_exampleinstall:
+	$(MAKE) -C linux exampleinstall
+
 linux_zipinstall:
 	$(MAKE) -C linux zipinstall
 
 linux_zipsourceinstall:
 	$(MAKE) -C linux zipsourceinstall
 
+linux_zipexampleinstall:
+	$(MAKE) -C linux zipexampleinstall
+
 linux_clean:
 	$(MAKE) -C linux clean
 
@@ -658,7 +729,7 @@ endif
 # Dir win32
 
 ifdef OBJECTDIRWIN32
-.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_zipinstall win32_zipsourceinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
+.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_exampleinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
 
 win32_all:
 	$(MAKE) -C win32 all
@@ -687,12 +758,18 @@ win32_install:
 win32_sourceinstall:
 	$(MAKE) -C win32 sourceinstall
 
+win32_exampleinstall:
+	$(MAKE) -C win32 exampleinstall
+
 win32_zipinstall:
 	$(MAKE) -C win32 zipinstall
 
 win32_zipsourceinstall:
 	$(MAKE) -C win32 zipsourceinstall
 
+win32_zipexampleinstall:
+	$(MAKE) -C win32 zipexampleinstall
+
 win32_clean:
 	$(MAKE) -C win32 clean
 
@@ -712,7 +789,7 @@ endif
 # Dir os2
 
 ifdef OBJECTDIROS2
-.PHONY:  os2_all os2_debug os2_examples os2_test os2_smart os2_shared os2_showinstall os2_install os2_sourceinstall os2_zipinstall os2_zipsourceinstall os2_clean os2_distclean os2_cleanall os2_require os2_info
+.PHONY:  os2_all os2_debug os2_examples os2_test os2_smart os2_shared os2_showinstall os2_install os2_sourceinstall os2_exampleinstall os2_zipinstall os2_zipsourceinstall os2_zipexampleinstall os2_clean os2_distclean os2_cleanall os2_require os2_info
 
 os2_all:
 	$(MAKE) -C os2 all
@@ -741,12 +818,18 @@ os2_install:
 os2_sourceinstall:
 	$(MAKE) -C os2 sourceinstall
 
+os2_exampleinstall:
+	$(MAKE) -C os2 exampleinstall
+
 os2_zipinstall:
 	$(MAKE) -C os2 zipinstall
 
 os2_zipsourceinstall:
 	$(MAKE) -C os2 zipsourceinstall
 
+os2_zipexampleinstall:
+	$(MAKE) -C os2 zipexampleinstall
+
 os2_clean:
 	$(MAKE) -C os2 clean
 
@@ -762,11 +845,13 @@ os2_require:
 os2_info:
 	$(MAKE) -C os2 info
 endif
+EXAMPLEDIRTESTS=1
+EXAMPLEDIRSHEDIT/GTK=1
 
 # Dir tests
 
-ifdef OBJECTDIRTESTS
-.PHONY:  tests_all tests_debug tests_examples tests_test tests_smart tests_shared tests_showinstall tests_install tests_sourceinstall tests_zipinstall tests_zipsourceinstall tests_clean tests_distclean tests_cleanall tests_require tests_info
+ifdef EXAMPLEDIRTESTS
+.PHONY:  tests_all tests_debug tests_examples tests_test tests_smart tests_shared tests_showinstall tests_install tests_sourceinstall tests_exampleinstall tests_zipinstall tests_zipsourceinstall tests_zipexampleinstall tests_clean tests_distclean tests_cleanall tests_require tests_info
 
 tests_all:
 	$(MAKE) -C tests all
@@ -795,12 +880,18 @@ tests_install:
 tests_sourceinstall:
 	$(MAKE) -C tests sourceinstall
 
+tests_exampleinstall:
+	$(MAKE) -C tests exampleinstall
+
 tests_zipinstall:
 	$(MAKE) -C tests zipinstall
 
 tests_zipsourceinstall:
 	$(MAKE) -C tests zipsourceinstall
 
+tests_zipexampleinstall:
+	$(MAKE) -C tests zipexampleinstall
+
 tests_clean:
 	$(MAKE) -C tests clean
 
@@ -817,6 +908,66 @@ tests_info:
 	$(MAKE) -C tests info
 endif
 
+# Dir shedit/gtk
+
+ifdef EXAMPLEDIRSHEDIT/GTK
+.PHONY:  shedit/gtk_all shedit/gtk_debug shedit/gtk_examples shedit/gtk_test shedit/gtk_smart shedit/gtk_shared shedit/gtk_showinstall shedit/gtk_install shedit/gtk_sourceinstall shedit/gtk_exampleinstall shedit/gtk_zipinstall shedit/gtk_zipsourceinstall shedit/gtk_zipexampleinstall shedit/gtk_clean shedit/gtk_distclean shedit/gtk_cleanall shedit/gtk_require shedit/gtk_info
+
+shedit/gtk_all:
+	$(MAKE) -C shedit/gtk all
+
+shedit/gtk_debug:
+	$(MAKE) -C shedit/gtk debug
+
+shedit/gtk_examples:
+	$(MAKE) -C shedit/gtk examples
+
+shedit/gtk_test:
+	$(MAKE) -C shedit/gtk test
+
+shedit/gtk_smart:
+	$(MAKE) -C shedit/gtk smart
+
+shedit/gtk_shared:
+	$(MAKE) -C shedit/gtk shared
+
+shedit/gtk_showinstall:
+	$(MAKE) -C shedit/gtk showinstall
+
+shedit/gtk_install:
+	$(MAKE) -C shedit/gtk install
+
+shedit/gtk_sourceinstall:
+	$(MAKE) -C shedit/gtk sourceinstall
+
+shedit/gtk_exampleinstall:
+	$(MAKE) -C shedit/gtk exampleinstall
+
+shedit/gtk_zipinstall:
+	$(MAKE) -C shedit/gtk zipinstall
+
+shedit/gtk_zipsourceinstall:
+	$(MAKE) -C shedit/gtk zipsourceinstall
+
+shedit/gtk_zipexampleinstall:
+	$(MAKE) -C shedit/gtk zipexampleinstall
+
+shedit/gtk_clean:
+	$(MAKE) -C shedit/gtk clean
+
+shedit/gtk_distclean:
+	$(MAKE) -C shedit/gtk distclean
+
+shedit/gtk_cleanall:
+	$(MAKE) -C shedit/gtk cleanall
+
+shedit/gtk_require:
+	$(MAKE) -C shedit/gtk require
+
+shedit/gtk_info:
+	$(MAKE) -C shedit/gtk info
+endif
+
 #####################################################################
 # Local Makefile
 #####################################################################

+ 4 - 2
fcl/Makefile.fpc

@@ -3,15 +3,17 @@
 #
 
 [targets]
-dirs=go32v2 linux win32 os2 tests
+dirs=go32v2 linux win32 os2
+exampledirs=tests shedit/gtk
 
 [install]
+examplesubdir=fcl
 packagename=fcl
-sourcesubdirs=0
 
 [sections]
 none=1
 zipsourceinstall=1
+zipexampleinstall=1
 
 [defaults]
 defaultdir=$(OS_TARGET)

+ 92 - 44
fcl/db/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -688,6 +688,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -723,26 +736,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDOPT
-override FPCOPT+=$(NEEDOPT)
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add GCC lib path if asked
-ifdef GCCLIBDIR
-override FPCOPT+=-Fl$(GCCLIBDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -785,21 +790,31 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Add GCC lib path if asked
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -856,10 +871,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -868,7 +887,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -891,13 +910,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -943,6 +963,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -956,7 +982,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -974,14 +1000,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -996,8 +1015,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1020,9 +1042,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1044,6 +1069,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1105,6 +1148,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1140,7 +1188,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 95 - 43
fcl/db/interbase/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/10]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -689,6 +689,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -724,36 +737,28 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDOPT
-override FPCOPT+=$(NEEDOPT)
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add GCC lib path if asked
-ifdef GCCLIBDIR
-override FPCOPT+=-Fl$(GCCLIBDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
 ifdef LINKSMART
-override FPCOPT+=-CX
+override FPCOPT+=-XX
 endif
 
-# Smartlinking
+# Smartlinking creation
 ifdef CREATESMART
-override FPCOPT+=-XX
+override FPCOPT+=-CX
 endif
 
 # Debug
@@ -786,21 +791,31 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Add GCC lib path if asked
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -853,10 +868,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -865,7 +884,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -940,6 +959,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -953,7 +978,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -971,12 +996,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-INSTALLPPULIBFILES:=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -991,8 +1011,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1015,9 +1038,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1039,6 +1065,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1100,6 +1144,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1133,6 +1182,9 @@ ifdef CLEANRSTFILES
 endif
 ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
+endif
+ifdef LIBNAME
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 42 - 2
fcl/go32v2/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/03]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -668,6 +668,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -834,10 +847,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -846,7 +863,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -1020,6 +1037,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1081,6 +1116,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################

+ 42 - 2
fcl/linux/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/03]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -699,6 +699,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -865,10 +878,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -877,7 +894,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -1051,6 +1068,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1112,6 +1147,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################

+ 90 - 43
fcl/os2/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -667,6 +667,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -702,26 +715,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDOPT
-override FPCOPT+=$(NEEDOPT)
-endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-ifdef NEEDINCDIR
-override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -764,21 +769,31 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef NEEDINCDIR
+override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -831,10 +846,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -843,7 +862,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -901,6 +920,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -914,7 +939,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -932,14 +957,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -954,8 +972,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -978,9 +999,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1002,6 +1026,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1063,6 +1105,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1098,7 +1145,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 80 - 33
fcl/shedit/gtk/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -669,6 +669,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -704,12 +717,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -752,21 +771,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -819,10 +834,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -831,7 +850,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -906,6 +925,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -919,7 +944,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -937,14 +962,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -959,8 +977,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -983,9 +1004,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1007,6 +1031,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1068,6 +1110,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1103,7 +1150,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 85 - 38
fcl/tests/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -719,6 +719,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -754,21 +767,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDOPT
-override FPCOPT+=$(NEEDOPT)
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -811,21 +821,26 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -878,10 +893,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -890,7 +909,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -961,6 +980,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -974,7 +999,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -992,14 +1017,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -1014,8 +1032,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1038,9 +1059,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1062,6 +1086,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1123,6 +1165,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1158,7 +1205,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 42 - 2
fcl/win32/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/03]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -668,6 +668,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -834,10 +847,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -846,7 +863,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -1020,6 +1037,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1081,6 +1116,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################

+ 29 - 8
ide/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -404,6 +404,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -432,10 +445,6 @@ endif
 
 debug: $(addsuffix _debug,$(DIROBJECTS))
 
-examples: $(addsuffix _examples,$(DIROBJECTS))
-
-test: $(addsuffix _test,$(DIROBJECTS))
-
 smart: $(addsuffix _smart,$(DIROBJECTS))
 
 shared: $(addsuffix _shared,$(DIROBJECTS))
@@ -458,7 +467,7 @@ cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
 
 require: $(addsuffix _require,$(DIROBJECTS))
 
-.PHONY:  debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
+.PHONY:  debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
 
 #####################################################################
 # SourceInstall rules
@@ -545,7 +554,7 @@ OBJECTDIRTEXT=1
 # Dir fake
 
 ifdef OBJECTDIRFAKE
-.PHONY:  fake_all fake_debug fake_examples fake_test fake_smart fake_shared fake_showinstall fake_install fake_sourceinstall fake_zipinstall fake_zipsourceinstall fake_clean fake_distclean fake_cleanall fake_require fake_info
+.PHONY:  fake_all fake_debug fake_examples fake_test fake_smart fake_shared fake_showinstall fake_install fake_sourceinstall fake_exampleinstall fake_zipinstall fake_zipsourceinstall fake_zipexampleinstall fake_clean fake_distclean fake_cleanall fake_require fake_info
 
 fake_all:
 	$(MAKE) -C fake all
@@ -574,12 +583,18 @@ fake_install:
 fake_sourceinstall:
 	$(MAKE) -C fake sourceinstall
 
+fake_exampleinstall:
+	$(MAKE) -C fake exampleinstall
+
 fake_zipinstall:
 	$(MAKE) -C fake zipinstall
 
 fake_zipsourceinstall:
 	$(MAKE) -C fake zipsourceinstall
 
+fake_zipexampleinstall:
+	$(MAKE) -C fake zipexampleinstall
+
 fake_clean:
 	$(MAKE) -C fake clean
 
@@ -599,7 +614,7 @@ endif
 # Dir text
 
 ifdef OBJECTDIRTEXT
-.PHONY:  text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_zipinstall text_zipsourceinstall text_clean text_distclean text_cleanall text_require text_info
+.PHONY:  text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_exampleinstall text_zipinstall text_zipsourceinstall text_zipexampleinstall text_clean text_distclean text_cleanall text_require text_info
 
 text_all:
 	$(MAKE) -C text all
@@ -628,12 +643,18 @@ text_install:
 text_sourceinstall:
 	$(MAKE) -C text sourceinstall
 
+text_exampleinstall:
+	$(MAKE) -C text exampleinstall
+
 text_zipinstall:
 	$(MAKE) -C text zipinstall
 
 text_zipsourceinstall:
 	$(MAKE) -C text zipsourceinstall
 
+text_zipexampleinstall:
+	$(MAKE) -C text zipexampleinstall
+
 text_clean:
 	$(MAKE) -C text clean
 

+ 16 - 10
ide/fake/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -227,10 +227,6 @@ all: $(addsuffix _all,$(DIROBJECTS))
 
 debug: $(addsuffix _debug,$(DIROBJECTS))
 
-examples: $(addsuffix _examples,$(DIROBJECTS))
-
-test: $(addsuffix _test,$(DIROBJECTS))
-
 smart: $(addsuffix _smart,$(DIROBJECTS))
 
 shared: $(addsuffix _shared,$(DIROBJECTS))
@@ -239,8 +235,6 @@ showinstall: $(addsuffix _showinstall,$(DIROBJECTS))
 
 install: $(addsuffix _install,$(DIROBJECTS))
 
-sourceinstall: $(addsuffix _sourceinstall,$(DIROBJECTS))
-
 clean: $(addsuffix _clean,$(DIROBJECTS))
 
 distclean: $(addsuffix _distclean,$(DIROBJECTS))
@@ -249,7 +243,7 @@ cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
 
 require: $(addsuffix _require,$(DIROBJECTS))
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall clean distclean cleanall require
+.PHONY:  all debug smart shared showinstall install clean distclean cleanall require
 
 #####################################################################
 # Directories
@@ -261,7 +255,7 @@ OBJECTDIRGDB=1
 # Dir compiler
 
 ifdef OBJECTDIRCOMPILER
-.PHONY:  compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_zipinstall compiler_zipsourceinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
+.PHONY:  compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_exampleinstall compiler_zipinstall compiler_zipsourceinstall compiler_zipexampleinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
 
 compiler_all:
 	$(MAKE) -C compiler all
@@ -290,12 +284,18 @@ compiler_install:
 compiler_sourceinstall:
 	$(MAKE) -C compiler sourceinstall
 
+compiler_exampleinstall:
+	$(MAKE) -C compiler exampleinstall
+
 compiler_zipinstall:
 	$(MAKE) -C compiler zipinstall
 
 compiler_zipsourceinstall:
 	$(MAKE) -C compiler zipsourceinstall
 
+compiler_zipexampleinstall:
+	$(MAKE) -C compiler zipexampleinstall
+
 compiler_clean:
 	$(MAKE) -C compiler clean
 
@@ -315,7 +315,7 @@ endif
 # Dir gdb
 
 ifdef OBJECTDIRGDB
-.PHONY:  gdb_all gdb_debug gdb_examples gdb_test gdb_smart gdb_shared gdb_showinstall gdb_install gdb_sourceinstall gdb_zipinstall gdb_zipsourceinstall gdb_clean gdb_distclean gdb_cleanall gdb_require gdb_info
+.PHONY:  gdb_all gdb_debug gdb_examples gdb_test gdb_smart gdb_shared gdb_showinstall gdb_install gdb_sourceinstall gdb_exampleinstall gdb_zipinstall gdb_zipsourceinstall gdb_zipexampleinstall gdb_clean gdb_distclean gdb_cleanall gdb_require gdb_info
 
 gdb_all:
 	$(MAKE) -C gdb all
@@ -344,12 +344,18 @@ gdb_install:
 gdb_sourceinstall:
 	$(MAKE) -C gdb sourceinstall
 
+gdb_exampleinstall:
+	$(MAKE) -C gdb exampleinstall
+
 gdb_zipinstall:
 	$(MAKE) -C gdb zipinstall
 
 gdb_zipsourceinstall:
 	$(MAKE) -C gdb zipsourceinstall
 
+gdb_zipexampleinstall:
+	$(MAKE) -C gdb zipexampleinstall
+
 gdb_clean:
 	$(MAKE) -C gdb clean
 

+ 80 - 33
ide/fake/compiler/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -598,6 +598,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -633,12 +646,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -681,21 +700,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -748,10 +763,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -760,7 +779,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -818,6 +837,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -831,7 +856,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -849,14 +874,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -871,8 +889,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -895,9 +916,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -919,6 +943,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -980,6 +1022,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1015,7 +1062,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 80 - 33
ide/fake/gdb/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -598,6 +598,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -633,12 +646,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -681,21 +700,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -748,10 +763,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -760,7 +779,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -818,6 +837,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -831,7 +856,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -849,14 +874,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -871,8 +889,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -895,9 +916,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -919,6 +943,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -980,6 +1022,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1015,7 +1062,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 60 - 15
ide/text/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/01]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -750,6 +750,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -909,15 +922,19 @@ showinstall: fpc_showinstall
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall sourceinstall zipinstall zipsourceinstall cleanall info
+.PHONY:  all debug smart shared showinstall sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall cleanall info
 
 #####################################################################
 # Exes
@@ -988,6 +1005,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -1001,7 +1024,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -1019,14 +1042,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -1041,8 +1057,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1065,9 +1084,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1089,6 +1111,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1150,6 +1190,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1185,7 +1230,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 4 - 3
install/debian/control

@@ -14,9 +14,10 @@ Description: Free Pascal Compiler
  The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit
  Pascal Compiler. It comes with fully TP 7.0 compatible run-time library.
  Some extensions are added to the language, like function overloading. Shared
- libraries can be linked. Basic Delphi support is already implemented (classes,
- exceptions,ansistrings,RTTI). This package contains the commandline compiler.
- You need at least the RTL package before you can start compiling anything.
+ libraries can be linked and created. Basic Delphi support is already
+ implemented (classes,exceptions,ansistrings). This package contains
+ the commandline compiler. You need at least the RTL package before you
+ can start compiling anything.
 
 Package: fp-utils
 Architecture: i386

+ 1 - 5
install/debian/fp-compiler.files.in

@@ -1,10 +1,6 @@
 /usr/lib/fpc/%{fpcversion}/ppc386
 /usr/lib/fpc/%{fpcversion}/samplecfg
 /usr/lib/fpc/%{fpcversion}/msg
-/usr/share/doc/fp-compiler/examples
-/usr/share/doc/fp-compiler/NEWS
-/usr/share/doc/fp-compiler/README
-/usr/share/doc/fp-compiler/faq.html
-/usr/share/doc/fp-compiler/faq.txt
+/usr/share/doc/fp-compiler
 /usr/share/man/man1/ppc386.1
 /usr/share/man/man5/ppc386.cfg.5

+ 1 - 0
install/debian/fp-units-api.files.in

@@ -1 +1,2 @@
+/usr/share/doc/fp-units-api
 /usr/lib/fpc/%{fpcversion}/units/linux/api

+ 1 - 0
install/debian/fp-units-base.files.in

@@ -1,3 +1,4 @@
+/usr/share/doc/fp-units-base
 
 /usr/lib/fpc/%{fpcversion}/units/linux/zlib.ppu
 

+ 1 - 0
install/debian/fp-units-db.files.in

@@ -1,3 +1,4 @@
+/usr/share/doc/fp-units-db
 
 /usr/lib/fpc/%{fpcversion}/units/linux/mysql_com.ppu 
 /usr/lib/fpc/%{fpcversion}/units/linux/mysql_version.ppu 

+ 1 - 0
install/debian/fp-units-fcl.files.in

@@ -1 +1,2 @@
+/usr/share/doc/fp-units-fcl
 /usr/lib/fpc/%{fpcversion}/units/linux/fcl

+ 1 - 0
install/debian/fp-units-gfx.files.in

@@ -1,3 +1,4 @@
+/usr/share/doc/fp-units-gfx
 
 /usr/lib/fpc/%{fpcversion}/units/linux/gl.ppu 
 /usr/lib/fpc/%{fpcversion}/units/linux/glut.ppu

+ 1 - 2
install/debian/fp-units-gtk.files.in

@@ -1,3 +1,4 @@
+/usr/share/doc/fp-units-gtk
 
 /usr/lib/fpc/%{fpcversion}/units/linux/glib.ppu 
 /usr/lib/fpc/%{fpcversion}/units/linux/gmodule.ppu 
@@ -10,5 +11,3 @@
 /usr/lib/fpc/%{fpcversion}/units/linux/libgdk.a 
 /usr/lib/fpc/%{fpcversion}/units/linux/gtk.o
 /usr/lib/fpc/%{fpcversion}/units/linux/libgtk.a
-
-/usr/share/doc/fp-units-gtk/

+ 6 - 0
install/debian/fp-units-misc.files.in

@@ -1,3 +1,9 @@
+/usr/share/doc/fp-units-misc
+
+/usr/lib/fpc/%{fpcversion}/units/linux/cmem.ppu
+
+/usr/lib/fpc/%{fpcversion}/units/linux/libcmem.a 
+/usr/lib/fpc/%{fpcversion}/units/linux/cmem.o
 
 /usr/lib/fpc/%{fpcversion}/units/linux/utmp.ppu
 

+ 2 - 0
install/debian/fp-units-net.files.in

@@ -1,3 +1,5 @@
+/usr/share/doc/fp-units-net
+
 /usr/lib/fpc/%{fpcversion}/units/linux/inet.ppu
 
 /usr/lib/fpc/%{fpcversion}/units/linux/libinet.a 

+ 2 - 0
install/debian/fp-utils.files.in

@@ -11,6 +11,8 @@
 /usr/bin/pyacc
 /usr/bin/h2pas
 /usr/bin/postw32
+/usr/bin/fpcmake
+/usr/bin/fprcp
 /usr/lib/fpc/%{fpcversion}/units/linux/lexlib.ppu
 /usr/lib/fpc/%{fpcversion}/units/linux/yacclib.ppu
 /usr/lib/fpc/%{fpcversion}/units/linux/lexlib.o

+ 12 - 4
install/debian/rules

@@ -9,14 +9,15 @@ DOCTYPE=pdf
 # Get Package version and FPC version out of changelog file
 PACKAGEVERSION:=$(shell head -n 1 debian/changelog | awk '{ print $$2 }' | tr -d '[()]')
 FPCVERSION:=$(shell echo $(PACKAGEVERSION) | awk -F '-' '{ print $$1 }')
-
 # Get directories	
 PWD:=$(shell pwd)
 BUILD_DIR=$(PWD)/debian/build
 INSTALL_DIR=$(PWD)/debian/tmp
+DOC_DIR=$(INSTALL_DIR)/usr/share/doc
+# Get utils
 NEWPP=$(PWD)/compiler/ppc386
 NEWPPUFILES=$(PWD)/utils/ppufiles
-
+# Create default options
 BUILDOPTS=PP=$(NEWPP)
 INSTALLOPTS=PP=$(NEWPP) PPUFILES=$(NEWPPUFILES) PREFIXINSTALLDIR=$(INSTALL_DIR)/usr
 
@@ -99,10 +100,18 @@ install-arch-stamp: build-arch-stamp debian-files-stamp
 	$(MAKE) utils_install $(INSTALLOPTS)
 	$(MAKE) packages_install $(INSTALLOPTS)
 
+	$(MAKE) fcl_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-fcl
+	$(MAKE) api_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-api
+	$(MAKE) -C packages pkggtk_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-gtk
+	$(MAKE) -C packages pkggfx_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-gfx
+	$(MAKE) -C packages pkgmisc_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-misc
+	$(MAKE) -C packages pkgbase_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-base
+	$(MAKE) -C packages pkgnet_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-net
+	$(MAKE) -C packages pkgdb_exampleinstall $(INSTALLOPTS) DOCINSTALLDIR=$(DOC_DIR)/fp-units-db
+
 	$(MAKE) man_install $(INSTALLOPTS) PREFIXINSTALLDIR=$(INSTALL_DIR)/usr/share
 	$(MAKE) demo_install $(INSTALLOPTS) DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-compiler
 	$(MAKE) doc_install $(INSTALLOPTS) DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-compiler
-	$(MAKE) -C packages/gtk installexamples $(INSTALLOPTS) DOCINSTALLDIR=$(INSTALL_DIR)/usr/share/doc/fp-units-gtk
 
 	touch install-arch-stamp
 
@@ -186,7 +195,6 @@ binary-arch: build-arch arrange-arch debian-files
 	dh_installchangelogs -pfp-utils logs/Changes.utils
 	dh_installchangelogs -pfp-units-fcl logs/Changes.fcl
 	dh_installchangelogs -pfp-units-api logs/Changes.api
-#	dh_installchangelogs -pfp-units-fv logs/Changes.fv
 
 	dh_undocumented -a
 	dh_installexamples -a

+ 117 - 48
install/demo/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -552,6 +552,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -587,13 +600,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -636,21 +654,18 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -693,10 +708,6 @@ all: fpc_all $(addsuffix _all,$(DIROBJECTS))
 
 debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS))
 
-examples: $(addsuffix _examples,$(DIROBJECTS))
-
-test: $(addsuffix _test,$(DIROBJECTS))
-
 smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS))
 
 shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS))
@@ -707,10 +718,14 @@ install: fpc_install $(addsuffix _install,$(DIROBJECTS))
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS))
 
 distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS))
@@ -719,7 +734,7 @@ cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS))
 
 require: $(addsuffix _require,$(DIROBJECTS))
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require
 
 #####################################################################
 # General compile rules
@@ -763,6 +778,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -776,7 +797,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -794,14 +815,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -816,8 +830,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -840,9 +857,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -864,6 +884,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -925,6 +963,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -960,7 +1003,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -993,7 +1036,7 @@ endif
 # Dir text
 
 ifdef OBJECTDIRTEXT
-.PHONY:  text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_zipinstall text_zipsourceinstall text_clean text_distclean text_cleanall text_require text_info
+.PHONY:  text_all text_debug text_examples text_test text_smart text_shared text_showinstall text_install text_sourceinstall text_exampleinstall text_zipinstall text_zipsourceinstall text_zipexampleinstall text_clean text_distclean text_cleanall text_require text_info
 
 text_all:
 	$(MAKE) -C text all
@@ -1022,12 +1065,18 @@ text_install:
 text_sourceinstall:
 	$(MAKE) -C text sourceinstall
 
+text_exampleinstall:
+	$(MAKE) -C text exampleinstall
+
 text_zipinstall:
 	$(MAKE) -C text zipinstall
 
 text_zipsourceinstall:
 	$(MAKE) -C text zipsourceinstall
 
+text_zipexampleinstall:
+	$(MAKE) -C text zipexampleinstall
+
 text_clean:
 	$(MAKE) -C text clean
 
@@ -1047,7 +1096,7 @@ endif
 # Dir graph
 
 ifdef OBJECTDIRGRAPH
-.PHONY:  graph_all graph_debug graph_examples graph_test graph_smart graph_shared graph_showinstall graph_install graph_sourceinstall graph_zipinstall graph_zipsourceinstall graph_clean graph_distclean graph_cleanall graph_require graph_info
+.PHONY:  graph_all graph_debug graph_examples graph_test graph_smart graph_shared graph_showinstall graph_install graph_sourceinstall graph_exampleinstall graph_zipinstall graph_zipsourceinstall graph_zipexampleinstall graph_clean graph_distclean graph_cleanall graph_require graph_info
 
 graph_all:
 	$(MAKE) -C graph all
@@ -1076,12 +1125,18 @@ graph_install:
 graph_sourceinstall:
 	$(MAKE) -C graph sourceinstall
 
+graph_exampleinstall:
+	$(MAKE) -C graph exampleinstall
+
 graph_zipinstall:
 	$(MAKE) -C graph zipinstall
 
 graph_zipsourceinstall:
 	$(MAKE) -C graph zipsourceinstall
 
+graph_zipexampleinstall:
+	$(MAKE) -C graph zipexampleinstall
+
 graph_clean:
 	$(MAKE) -C graph clean
 
@@ -1101,7 +1156,7 @@ endif
 # Dir linux
 
 ifdef OBJECTDIRLINUX
-.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_zipinstall linux_zipsourceinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
+.PHONY:  linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_exampleinstall linux_zipinstall linux_zipsourceinstall linux_zipexampleinstall linux_clean linux_distclean linux_cleanall linux_require linux_info
 
 linux_all:
 	$(MAKE) -C linux all
@@ -1130,12 +1185,18 @@ linux_install:
 linux_sourceinstall:
 	$(MAKE) -C linux sourceinstall
 
+linux_exampleinstall:
+	$(MAKE) -C linux exampleinstall
+
 linux_zipinstall:
 	$(MAKE) -C linux zipinstall
 
 linux_zipsourceinstall:
 	$(MAKE) -C linux zipsourceinstall
 
+linux_zipexampleinstall:
+	$(MAKE) -C linux zipexampleinstall
+
 linux_clean:
 	$(MAKE) -C linux clean
 
@@ -1155,7 +1216,7 @@ endif
 # Dir modex
 
 ifdef OBJECTDIRMODEX
-.PHONY:  modex_all modex_debug modex_examples modex_test modex_smart modex_shared modex_showinstall modex_install modex_sourceinstall modex_zipinstall modex_zipsourceinstall modex_clean modex_distclean modex_cleanall modex_require modex_info
+.PHONY:  modex_all modex_debug modex_examples modex_test modex_smart modex_shared modex_showinstall modex_install modex_sourceinstall modex_exampleinstall modex_zipinstall modex_zipsourceinstall modex_zipexampleinstall modex_clean modex_distclean modex_cleanall modex_require modex_info
 
 modex_all:
 	$(MAKE) -C modex all
@@ -1184,12 +1245,18 @@ modex_install:
 modex_sourceinstall:
 	$(MAKE) -C modex sourceinstall
 
+modex_exampleinstall:
+	$(MAKE) -C modex exampleinstall
+
 modex_zipinstall:
 	$(MAKE) -C modex zipinstall
 
 modex_zipsourceinstall:
 	$(MAKE) -C modex zipsourceinstall
 
+modex_zipexampleinstall:
+	$(MAKE) -C modex zipexampleinstall
+
 modex_clean:
 	$(MAKE) -C modex clean
 
@@ -1209,7 +1276,7 @@ endif
 # Dir win32
 
 ifdef OBJECTDIRWIN32
-.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_zipinstall win32_zipsourceinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
+.PHONY:  win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_exampleinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_clean win32_distclean win32_cleanall win32_require win32_info
 
 win32_all:
 	$(MAKE) -C win32 all
@@ -1238,12 +1305,18 @@ win32_install:
 win32_sourceinstall:
 	$(MAKE) -C win32 sourceinstall
 
+win32_exampleinstall:
+	$(MAKE) -C win32 exampleinstall
+
 win32_zipinstall:
 	$(MAKE) -C win32 zipinstall
 
 win32_zipsourceinstall:
 	$(MAKE) -C win32 zipsourceinstall
 
+win32_zipexampleinstall:
+	$(MAKE) -C win32 zipexampleinstall
+
 win32_clean:
 	$(MAKE) -C win32 clean
 
@@ -1290,9 +1363,5 @@ info:
 
 .PHONY: installexamples
 
-ifndef EXAMPLESINSTALLDIR
-EXAMPLESINSTALLDIR=$(DOCINSTALLDIR)/examples
-endif
-
 installexamples:
-	$(MAKE) sourceinstall SOURCEINSTALLDIR=$(EXAMPLESINSTALLDIR)
+	$(MAKE) sourceinstall SOURCEINSTALLDIR=$(EXAMPLEINSTALLDIR)

+ 1 - 6
install/demo/Makefile.fpc

@@ -10,7 +10,6 @@ dirs_linux=linux
 
 [install]
 packagename=demo
-sourcesubdirs=0
 
 [defaults]
 defaultrule=all
@@ -41,9 +40,5 @@ info:
 
 .PHONY: installexamples
 
-ifndef EXAMPLESINSTALLDIR
-EXAMPLESINSTALLDIR=$(DOCINSTALLDIR)/examples
-endif
-
 installexamples:
-        $(MAKE) sourceinstall SOURCEINSTALLDIR=$(EXAMPLESINSTALLDIR)
+        $(MAKE) sourceinstall SOURCEINSTALLDIR=$(EXAMPLEINSTALLDIR)

+ 83 - 36
install/demo/graph/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -651,6 +651,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -686,17 +699,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -739,21 +753,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -804,17 +819,21 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 distclean: fpc_distclean
 
 cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall distclean cleanall info
+.PHONY:  debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall distclean cleanall info
 
 #####################################################################
 # Units
@@ -889,6 +908,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -902,7 +927,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -920,14 +945,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -942,8 +960,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -966,9 +987,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -990,6 +1014,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1051,6 +1093,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1086,7 +1133,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 36
install/demo/linux/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -613,6 +613,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -648,17 +661,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -701,21 +715,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -768,10 +783,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -780,7 +799,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -841,6 +860,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -854,7 +879,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -872,14 +897,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -894,8 +912,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -918,9 +939,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -942,6 +966,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1003,6 +1045,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1038,7 +1085,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 36
install/demo/modex/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -613,6 +613,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -648,17 +661,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -701,21 +715,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -768,10 +783,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -780,7 +799,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -841,6 +860,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -854,7 +879,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -872,14 +897,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -894,8 +912,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -918,9 +939,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -942,6 +966,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1003,6 +1045,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1038,7 +1085,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 36
install/demo/text/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -611,6 +611,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -646,17 +659,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -699,21 +713,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -766,10 +781,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -778,7 +797,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -839,6 +858,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -852,7 +877,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -870,14 +895,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -892,8 +910,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -916,9 +937,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -940,6 +964,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1001,6 +1043,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1036,7 +1083,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 36
install/demo/win32/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -613,6 +613,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -648,17 +661,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -701,21 +715,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -768,10 +783,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -780,7 +799,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -841,6 +860,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -854,7 +879,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -872,14 +897,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -894,8 +912,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -918,9 +939,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -942,6 +966,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1003,6 +1045,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1038,7 +1085,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 14 - 9
install/fpc-0.99.15.spec

@@ -45,6 +45,10 @@ INSTALLOPTS="PP=${NEWPP} PPUFILES=${NEWPPUFILES} PREFIXINSTALLDIR=/usr"
 	make packages_install ${INSTALLOPTS}
 	make utils_install ${INSTALLOPTS}
 
+	make fcl_exampleinstall ${INSTALLOPTS} DOCINSTALLDIR=%{docdir}
+	make api_exampleinstall ${INSTALLOPTS} DOCINSTALLDIR=%{docdir}
+	make packages_exampleinstall ${INSTALLOPTS} DOCINSTALLDIR=%{docdir}
+
 	make demo_install ${INSTALLOPTS} DOCINSTALLDIR=%{docdir}
 	make doc_install ${INSTALLOPTS} DOCINSTALLDIR=%{docdir}
 	make man_install ${INSTALLOPTS}
@@ -71,20 +75,21 @@ $FPCDIR/samplecfg $FPCDIR
 
 
 %files
-/usr/bin/ppufiles 
-/usr/bin/ppudump 
-/usr/bin/ppumove 
-/usr/bin/ppdep 
-/usr/bin/ptop 
-/usr/bin/rstconv 
-/usr/bin/data2inc 
+/usr/bin/ppufiles
+/usr/bin/ppudump
+/usr/bin/ppumove
+/usr/bin/ppdep
+/usr/bin/ptop
+/usr/bin/rstconv
+/usr/bin/data2inc
 /usr/bin/bin2obj
 /usr/bin/delp
-/usr/bin/plex 
+/usr/bin/plex
 /usr/bin/pyacc
 /usr/bin/h2pas
-/usr/bin/fprcp
 /usr/bin/postw32
+/usr/bin/fpcmake
+/usr/bin/fprcp
 %{fpcdir}
 /usr/lib/fpc/lexyacc/yylex.cod 
 /usr/lib/fpc/lexyacc/yyparse.cod

+ 83 - 36
install/fpinst/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -690,6 +690,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -725,17 +738,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -778,21 +792,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -845,10 +860,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -857,7 +876,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -918,6 +937,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -931,7 +956,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -949,14 +974,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -971,8 +989,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -995,9 +1016,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1019,6 +1043,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1080,6 +1122,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1115,7 +1162,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 184 - 31
packages/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -358,7 +358,7 @@ endif
 # Pkg all
 
 ifdef PKGALL
-.PHONY:  pkgall_all pkgall_debug pkgall_examples pkgall_test pkgall_smart pkgall_shared pkgall_showinstall pkgall_install pkgall_sourceinstall pkgall_zipinstall pkgall_zipsourceinstall pkgall_clean pkgall_distclean pkgall_cleanall pkgall_require pkgall_info
+.PHONY:  pkgall_all pkgall_debug pkgall_examples pkgall_test pkgall_smart pkgall_shared pkgall_showinstall pkgall_install pkgall_sourceinstall pkgall_exampleinstall pkgall_zipinstall pkgall_zipsourceinstall pkgall_zipexampleinstall pkgall_clean pkgall_distclean pkgall_cleanall pkgall_require pkgall_info
 
 pkgall_all: $(addsuffix _all,$(DIROBJECTS))
 
@@ -378,6 +378,8 @@ pkgall_install: $(addsuffix _install,$(DIROBJECTS))
 
 pkgall_sourceinstall: $(addsuffix _sourceinstall,$(DIROBJECTS))
 
+pkgall_exampleinstall: $(addsuffix _exampleinstall,$(DIROBJECTS))
+
 pkgall_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=all ZIPTARGET=pkgall_install
 
@@ -397,7 +399,7 @@ endif
 # Pkg base
 
 ifdef PKGBASE
-.PHONY:  pkgbase_all pkgbase_debug pkgbase_examples pkgbase_test pkgbase_smart pkgbase_shared pkgbase_showinstall pkgbase_install pkgbase_sourceinstall pkgbase_zipinstall pkgbase_zipsourceinstall pkgbase_clean pkgbase_distclean pkgbase_cleanall pkgbase_require pkgbase_info
+.PHONY:  pkgbase_all pkgbase_debug pkgbase_examples pkgbase_test pkgbase_smart pkgbase_shared pkgbase_showinstall pkgbase_install pkgbase_sourceinstall pkgbase_exampleinstall pkgbase_zipinstall pkgbase_zipsourceinstall pkgbase_zipexampleinstall pkgbase_clean pkgbase_distclean pkgbase_cleanall pkgbase_require pkgbase_info
 
 override PKGOBJECTS+=pkgbase
 pkgbase_all: $(addsuffix _all,$(PKGBASE))
@@ -418,6 +420,8 @@ pkgbase_install: $(addsuffix _install,$(PKGBASE))
 
 pkgbase_sourceinstall: $(addsuffix _sourceinstall,$(PKGBASE))
 
+pkgbase_exampleinstall: $(addsuffix _exampleinstall,$(PKGBASE))
+
 pkgbase_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=base ZIPTARGET=pkgbase_install
 
@@ -437,7 +441,7 @@ endif
 # Pkg gtk
 
 ifdef PKGGTK
-.PHONY:  pkggtk_all pkggtk_debug pkggtk_examples pkggtk_test pkggtk_smart pkggtk_shared pkggtk_showinstall pkggtk_install pkggtk_sourceinstall pkggtk_zipinstall pkggtk_zipsourceinstall pkggtk_clean pkggtk_distclean pkggtk_cleanall pkggtk_require pkggtk_info
+.PHONY:  pkggtk_all pkggtk_debug pkggtk_examples pkggtk_test pkggtk_smart pkggtk_shared pkggtk_showinstall pkggtk_install pkggtk_sourceinstall pkggtk_exampleinstall pkggtk_zipinstall pkggtk_zipsourceinstall pkggtk_zipexampleinstall pkggtk_clean pkggtk_distclean pkggtk_cleanall pkggtk_require pkggtk_info
 
 override PKGOBJECTS+=pkggtk
 pkggtk_all: $(addsuffix _all,$(PKGGTK))
@@ -458,6 +462,8 @@ pkggtk_install: $(addsuffix _install,$(PKGGTK))
 
 pkggtk_sourceinstall: $(addsuffix _sourceinstall,$(PKGGTK))
 
+pkggtk_exampleinstall: $(addsuffix _exampleinstall,$(PKGGTK))
+
 pkggtk_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=gtk ZIPTARGET=pkggtk_install
 
@@ -477,7 +483,7 @@ endif
 # Pkg net
 
 ifdef PKGNET
-.PHONY:  pkgnet_all pkgnet_debug pkgnet_examples pkgnet_test pkgnet_smart pkgnet_shared pkgnet_showinstall pkgnet_install pkgnet_sourceinstall pkgnet_zipinstall pkgnet_zipsourceinstall pkgnet_clean pkgnet_distclean pkgnet_cleanall pkgnet_require pkgnet_info
+.PHONY:  pkgnet_all pkgnet_debug pkgnet_examples pkgnet_test pkgnet_smart pkgnet_shared pkgnet_showinstall pkgnet_install pkgnet_sourceinstall pkgnet_exampleinstall pkgnet_zipinstall pkgnet_zipsourceinstall pkgnet_zipexampleinstall pkgnet_clean pkgnet_distclean pkgnet_cleanall pkgnet_require pkgnet_info
 
 override PKGOBJECTS+=pkgnet
 pkgnet_all: $(addsuffix _all,$(PKGNET))
@@ -498,6 +504,8 @@ pkgnet_install: $(addsuffix _install,$(PKGNET))
 
 pkgnet_sourceinstall: $(addsuffix _sourceinstall,$(PKGNET))
 
+pkgnet_exampleinstall: $(addsuffix _exampleinstall,$(PKGNET))
+
 pkgnet_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=net ZIPTARGET=pkgnet_install
 
@@ -517,7 +525,7 @@ endif
 # Pkg db
 
 ifdef PKGDB
-.PHONY:  pkgdb_all pkgdb_debug pkgdb_examples pkgdb_test pkgdb_smart pkgdb_shared pkgdb_showinstall pkgdb_install pkgdb_sourceinstall pkgdb_zipinstall pkgdb_zipsourceinstall pkgdb_clean pkgdb_distclean pkgdb_cleanall pkgdb_require pkgdb_info
+.PHONY:  pkgdb_all pkgdb_debug pkgdb_examples pkgdb_test pkgdb_smart pkgdb_shared pkgdb_showinstall pkgdb_install pkgdb_sourceinstall pkgdb_exampleinstall pkgdb_zipinstall pkgdb_zipsourceinstall pkgdb_zipexampleinstall pkgdb_clean pkgdb_distclean pkgdb_cleanall pkgdb_require pkgdb_info
 
 override PKGOBJECTS+=pkgdb
 pkgdb_all: $(addsuffix _all,$(PKGDB))
@@ -538,6 +546,8 @@ pkgdb_install: $(addsuffix _install,$(PKGDB))
 
 pkgdb_sourceinstall: $(addsuffix _sourceinstall,$(PKGDB))
 
+pkgdb_exampleinstall: $(addsuffix _exampleinstall,$(PKGDB))
+
 pkgdb_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=db ZIPTARGET=pkgdb_install
 
@@ -557,7 +567,7 @@ endif
 # Pkg gfx
 
 ifdef PKGGFX
-.PHONY:  pkggfx_all pkggfx_debug pkggfx_examples pkggfx_test pkggfx_smart pkggfx_shared pkggfx_showinstall pkggfx_install pkggfx_sourceinstall pkggfx_zipinstall pkggfx_zipsourceinstall pkggfx_clean pkggfx_distclean pkggfx_cleanall pkggfx_require pkggfx_info
+.PHONY:  pkggfx_all pkggfx_debug pkggfx_examples pkggfx_test pkggfx_smart pkggfx_shared pkggfx_showinstall pkggfx_install pkggfx_sourceinstall pkggfx_exampleinstall pkggfx_zipinstall pkggfx_zipsourceinstall pkggfx_zipexampleinstall pkggfx_clean pkggfx_distclean pkggfx_cleanall pkggfx_require pkggfx_info
 
 override PKGOBJECTS+=pkggfx
 pkggfx_all: $(addsuffix _all,$(PKGGFX))
@@ -578,6 +588,8 @@ pkggfx_install: $(addsuffix _install,$(PKGGFX))
 
 pkggfx_sourceinstall: $(addsuffix _sourceinstall,$(PKGGFX))
 
+pkggfx_exampleinstall: $(addsuffix _exampleinstall,$(PKGGFX))
+
 pkggfx_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=gfx ZIPTARGET=pkggfx_install
 
@@ -597,7 +609,7 @@ endif
 # Pkg misc
 
 ifdef PKGMISC
-.PHONY:  pkgmisc_all pkgmisc_debug pkgmisc_examples pkgmisc_test pkgmisc_smart pkgmisc_shared pkgmisc_showinstall pkgmisc_install pkgmisc_sourceinstall pkgmisc_zipinstall pkgmisc_zipsourceinstall pkgmisc_clean pkgmisc_distclean pkgmisc_cleanall pkgmisc_require pkgmisc_info
+.PHONY:  pkgmisc_all pkgmisc_debug pkgmisc_examples pkgmisc_test pkgmisc_smart pkgmisc_shared pkgmisc_showinstall pkgmisc_install pkgmisc_sourceinstall pkgmisc_exampleinstall pkgmisc_zipinstall pkgmisc_zipsourceinstall pkgmisc_zipexampleinstall pkgmisc_clean pkgmisc_distclean pkgmisc_cleanall pkgmisc_require pkgmisc_info
 
 override PKGOBJECTS+=pkgmisc
 pkgmisc_all: $(addsuffix _all,$(PKGMISC))
@@ -618,6 +630,8 @@ pkgmisc_install: $(addsuffix _install,$(PKGMISC))
 
 pkgmisc_sourceinstall: $(addsuffix _sourceinstall,$(PKGMISC))
 
+pkgmisc_exampleinstall: $(addsuffix _exampleinstall,$(PKGMISC))
+
 pkgmisc_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=misc ZIPTARGET=pkgmisc_install
 
@@ -637,7 +651,7 @@ endif
 # Pkg bas
 
 ifdef PKGBAS
-.PHONY:  pkgbas_all pkgbas_debug pkgbas_examples pkgbas_test pkgbas_smart pkgbas_shared pkgbas_showinstall pkgbas_install pkgbas_sourceinstall pkgbas_zipinstall pkgbas_zipsourceinstall pkgbas_clean pkgbas_distclean pkgbas_cleanall pkgbas_require pkgbas_info
+.PHONY:  pkgbas_all pkgbas_debug pkgbas_examples pkgbas_test pkgbas_smart pkgbas_shared pkgbas_showinstall pkgbas_install pkgbas_sourceinstall pkgbas_exampleinstall pkgbas_zipinstall pkgbas_zipsourceinstall pkgbas_zipexampleinstall pkgbas_clean pkgbas_distclean pkgbas_cleanall pkgbas_require pkgbas_info
 
 override PKGOBJECTS+=pkgbas
 pkgbas_all: $(addsuffix _all,$(PKGBAS))
@@ -658,6 +672,8 @@ pkgbas_install: $(addsuffix _install,$(PKGBAS))
 
 pkgbas_sourceinstall: $(addsuffix _sourceinstall,$(PKGBAS))
 
+pkgbas_exampleinstall: $(addsuffix _exampleinstall,$(PKGBAS))
+
 pkgbas_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=bas ZIPTARGET=pkgbas_install
 
@@ -677,7 +693,7 @@ endif
 # Pkg mis
 
 ifdef PKGMIS
-.PHONY:  pkgmis_all pkgmis_debug pkgmis_examples pkgmis_test pkgmis_smart pkgmis_shared pkgmis_showinstall pkgmis_install pkgmis_sourceinstall pkgmis_zipinstall pkgmis_zipsourceinstall pkgmis_clean pkgmis_distclean pkgmis_cleanall pkgmis_require pkgmis_info
+.PHONY:  pkgmis_all pkgmis_debug pkgmis_examples pkgmis_test pkgmis_smart pkgmis_shared pkgmis_showinstall pkgmis_install pkgmis_sourceinstall pkgmis_exampleinstall pkgmis_zipinstall pkgmis_zipsourceinstall pkgmis_zipexampleinstall pkgmis_clean pkgmis_distclean pkgmis_cleanall pkgmis_require pkgmis_info
 
 override PKGOBJECTS+=pkgmis
 pkgmis_all: $(addsuffix _all,$(PKGMIS))
@@ -698,6 +714,8 @@ pkgmis_install: $(addsuffix _install,$(PKGMIS))
 
 pkgmis_sourceinstall: $(addsuffix _sourceinstall,$(PKGMIS))
 
+pkgmis_exampleinstall: $(addsuffix _exampleinstall,$(PKGMIS))
+
 pkgmis_zipinstall:
 	$(MAKE) fpc_zipinstall PACKAGENAME=mis ZIPTARGET=pkgmis_install
 
@@ -794,6 +812,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -838,6 +869,8 @@ install: $(addsuffix _install,$(DIROBJECTS))
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: $(addsuffix _exampleinstall,$(DIROBJECTS))
+
 zipinstall: $(addsuffix _zipinstall,$(PKGOBJECTS))
 
 zipsourceinstall: fpc_zipsourceinstall
@@ -850,7 +883,7 @@ cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
 
 require: $(addsuffix _require,$(DIROBJECTS))
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall require
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall clean distclean cleanall require
 
 #####################################################################
 # SourceInstall rules
@@ -975,7 +1008,7 @@ endif
 # Dir zlib
 
 ifdef OBJECTDIRZLIB
-.PHONY:  zlib_all zlib_debug zlib_examples zlib_test zlib_smart zlib_shared zlib_showinstall zlib_install zlib_sourceinstall zlib_zipinstall zlib_zipsourceinstall zlib_clean zlib_distclean zlib_cleanall zlib_require zlib_info
+.PHONY:  zlib_all zlib_debug zlib_examples zlib_test zlib_smart zlib_shared zlib_showinstall zlib_install zlib_sourceinstall zlib_exampleinstall zlib_zipinstall zlib_zipsourceinstall zlib_zipexampleinstall zlib_clean zlib_distclean zlib_cleanall zlib_require zlib_info
 
 zlib_all:
 	$(MAKE) -C zlib all
@@ -1004,12 +1037,18 @@ zlib_install:
 zlib_sourceinstall:
 	$(MAKE) -C zlib sourceinstall
 
+zlib_exampleinstall:
+	$(MAKE) -C zlib exampleinstall
+
 zlib_zipinstall:
 	$(MAKE) -C zlib zipinstall
 
 zlib_zipsourceinstall:
 	$(MAKE) -C zlib zipsourceinstall
 
+zlib_zipexampleinstall:
+	$(MAKE) -C zlib zipexampleinstall
+
 zlib_clean:
 	$(MAKE) -C zlib clean
 
@@ -1029,7 +1068,7 @@ endif
 # Dir ncurses
 
 ifdef OBJECTDIRNCURSES
-.PHONY:  ncurses_all ncurses_debug ncurses_examples ncurses_test ncurses_smart ncurses_shared ncurses_showinstall ncurses_install ncurses_sourceinstall ncurses_zipinstall ncurses_zipsourceinstall ncurses_clean ncurses_distclean ncurses_cleanall ncurses_require ncurses_info
+.PHONY:  ncurses_all ncurses_debug ncurses_examples ncurses_test ncurses_smart ncurses_shared ncurses_showinstall ncurses_install ncurses_sourceinstall ncurses_exampleinstall ncurses_zipinstall ncurses_zipsourceinstall ncurses_zipexampleinstall ncurses_clean ncurses_distclean ncurses_cleanall ncurses_require ncurses_info
 
 ncurses_all:
 	$(MAKE) -C ncurses all
@@ -1058,12 +1097,18 @@ ncurses_install:
 ncurses_sourceinstall:
 	$(MAKE) -C ncurses sourceinstall
 
+ncurses_exampleinstall:
+	$(MAKE) -C ncurses exampleinstall
+
 ncurses_zipinstall:
 	$(MAKE) -C ncurses zipinstall
 
 ncurses_zipsourceinstall:
 	$(MAKE) -C ncurses zipsourceinstall
 
+ncurses_zipexampleinstall:
+	$(MAKE) -C ncurses zipexampleinstall
+
 ncurses_clean:
 	$(MAKE) -C ncurses clean
 
@@ -1083,7 +1128,7 @@ endif
 # Dir x11
 
 ifdef OBJECTDIRX11
-.PHONY:  x11_all x11_debug x11_examples x11_test x11_smart x11_shared x11_showinstall x11_install x11_sourceinstall x11_zipinstall x11_zipsourceinstall x11_clean x11_distclean x11_cleanall x11_require x11_info
+.PHONY:  x11_all x11_debug x11_examples x11_test x11_smart x11_shared x11_showinstall x11_install x11_sourceinstall x11_exampleinstall x11_zipinstall x11_zipsourceinstall x11_zipexampleinstall x11_clean x11_distclean x11_cleanall x11_require x11_info
 
 x11_all:
 	$(MAKE) -C x11 all
@@ -1112,12 +1157,18 @@ x11_install:
 x11_sourceinstall:
 	$(MAKE) -C x11 sourceinstall
 
+x11_exampleinstall:
+	$(MAKE) -C x11 exampleinstall
+
 x11_zipinstall:
 	$(MAKE) -C x11 zipinstall
 
 x11_zipsourceinstall:
 	$(MAKE) -C x11 zipsourceinstall
 
+x11_zipexampleinstall:
+	$(MAKE) -C x11 zipexampleinstall
+
 x11_clean:
 	$(MAKE) -C x11 clean
 
@@ -1137,7 +1188,7 @@ endif
 # Dir gtk
 
 ifdef OBJECTDIRGTK
-.PHONY:  gtk_all gtk_debug gtk_examples gtk_test gtk_smart gtk_shared gtk_showinstall gtk_install gtk_sourceinstall gtk_zipinstall gtk_zipsourceinstall gtk_clean gtk_distclean gtk_cleanall gtk_require gtk_info
+.PHONY:  gtk_all gtk_debug gtk_examples gtk_test gtk_smart gtk_shared gtk_showinstall gtk_install gtk_sourceinstall gtk_exampleinstall gtk_zipinstall gtk_zipsourceinstall gtk_zipexampleinstall gtk_clean gtk_distclean gtk_cleanall gtk_require gtk_info
 
 gtk_all:
 	$(MAKE) -C gtk all
@@ -1166,12 +1217,18 @@ gtk_install:
 gtk_sourceinstall:
 	$(MAKE) -C gtk sourceinstall
 
+gtk_exampleinstall:
+	$(MAKE) -C gtk exampleinstall
+
 gtk_zipinstall:
 	$(MAKE) -C gtk zipinstall
 
 gtk_zipsourceinstall:
 	$(MAKE) -C gtk zipsourceinstall
 
+gtk_zipexampleinstall:
+	$(MAKE) -C gtk zipexampleinstall
+
 gtk_clean:
 	$(MAKE) -C gtk clean
 
@@ -1191,7 +1248,7 @@ endif
 # Dir syslog
 
 ifdef OBJECTDIRSYSLOG
-.PHONY:  syslog_all syslog_debug syslog_examples syslog_test syslog_smart syslog_shared syslog_showinstall syslog_install syslog_sourceinstall syslog_zipinstall syslog_zipsourceinstall syslog_clean syslog_distclean syslog_cleanall syslog_require syslog_info
+.PHONY:  syslog_all syslog_debug syslog_examples syslog_test syslog_smart syslog_shared syslog_showinstall syslog_install syslog_sourceinstall syslog_exampleinstall syslog_zipinstall syslog_zipsourceinstall syslog_zipexampleinstall syslog_clean syslog_distclean syslog_cleanall syslog_require syslog_info
 
 syslog_all:
 	$(MAKE) -C syslog all
@@ -1220,12 +1277,18 @@ syslog_install:
 syslog_sourceinstall:
 	$(MAKE) -C syslog sourceinstall
 
+syslog_exampleinstall:
+	$(MAKE) -C syslog exampleinstall
+
 syslog_zipinstall:
 	$(MAKE) -C syslog zipinstall
 
 syslog_zipsourceinstall:
 	$(MAKE) -C syslog zipsourceinstall
 
+syslog_zipexampleinstall:
+	$(MAKE) -C syslog zipexampleinstall
+
 syslog_clean:
 	$(MAKE) -C syslog clean
 
@@ -1245,7 +1308,7 @@ endif
 # Dir inet
 
 ifdef OBJECTDIRINET
-.PHONY:  inet_all inet_debug inet_examples inet_test inet_smart inet_shared inet_showinstall inet_install inet_sourceinstall inet_zipinstall inet_zipsourceinstall inet_clean inet_distclean inet_cleanall inet_require inet_info
+.PHONY:  inet_all inet_debug inet_examples inet_test inet_smart inet_shared inet_showinstall inet_install inet_sourceinstall inet_exampleinstall inet_zipinstall inet_zipsourceinstall inet_zipexampleinstall inet_clean inet_distclean inet_cleanall inet_require inet_info
 
 inet_all:
 	$(MAKE) -C inet all
@@ -1274,12 +1337,18 @@ inet_install:
 inet_sourceinstall:
 	$(MAKE) -C inet sourceinstall
 
+inet_exampleinstall:
+	$(MAKE) -C inet exampleinstall
+
 inet_zipinstall:
 	$(MAKE) -C inet zipinstall
 
 inet_zipsourceinstall:
 	$(MAKE) -C inet zipsourceinstall
 
+inet_zipexampleinstall:
+	$(MAKE) -C inet zipexampleinstall
+
 inet_clean:
 	$(MAKE) -C inet clean
 
@@ -1299,7 +1368,7 @@ endif
 # Dir uncgi
 
 ifdef OBJECTDIRUNCGI
-.PHONY:  uncgi_all uncgi_debug uncgi_examples uncgi_test uncgi_smart uncgi_shared uncgi_showinstall uncgi_install uncgi_sourceinstall uncgi_zipinstall uncgi_zipsourceinstall uncgi_clean uncgi_distclean uncgi_cleanall uncgi_require uncgi_info
+.PHONY:  uncgi_all uncgi_debug uncgi_examples uncgi_test uncgi_smart uncgi_shared uncgi_showinstall uncgi_install uncgi_sourceinstall uncgi_exampleinstall uncgi_zipinstall uncgi_zipsourceinstall uncgi_zipexampleinstall uncgi_clean uncgi_distclean uncgi_cleanall uncgi_require uncgi_info
 
 uncgi_all:
 	$(MAKE) -C uncgi all
@@ -1328,12 +1397,18 @@ uncgi_install:
 uncgi_sourceinstall:
 	$(MAKE) -C uncgi sourceinstall
 
+uncgi_exampleinstall:
+	$(MAKE) -C uncgi exampleinstall
+
 uncgi_zipinstall:
 	$(MAKE) -C uncgi zipinstall
 
 uncgi_zipsourceinstall:
 	$(MAKE) -C uncgi zipsourceinstall
 
+uncgi_zipexampleinstall:
+	$(MAKE) -C uncgi zipexampleinstall
+
 uncgi_clean:
 	$(MAKE) -C uncgi clean
 
@@ -1353,7 +1428,7 @@ endif
 # Dir mysql
 
 ifdef OBJECTDIRMYSQL
-.PHONY:  mysql_all mysql_debug mysql_examples mysql_test mysql_smart mysql_shared mysql_showinstall mysql_install mysql_sourceinstall mysql_zipinstall mysql_zipsourceinstall mysql_clean mysql_distclean mysql_cleanall mysql_require mysql_info
+.PHONY:  mysql_all mysql_debug mysql_examples mysql_test mysql_smart mysql_shared mysql_showinstall mysql_install mysql_sourceinstall mysql_exampleinstall mysql_zipinstall mysql_zipsourceinstall mysql_zipexampleinstall mysql_clean mysql_distclean mysql_cleanall mysql_require mysql_info
 
 mysql_all:
 	$(MAKE) -C mysql all
@@ -1382,12 +1457,18 @@ mysql_install:
 mysql_sourceinstall:
 	$(MAKE) -C mysql sourceinstall
 
+mysql_exampleinstall:
+	$(MAKE) -C mysql exampleinstall
+
 mysql_zipinstall:
 	$(MAKE) -C mysql zipinstall
 
 mysql_zipsourceinstall:
 	$(MAKE) -C mysql zipsourceinstall
 
+mysql_zipexampleinstall:
+	$(MAKE) -C mysql zipexampleinstall
+
 mysql_clean:
 	$(MAKE) -C mysql clean
 
@@ -1407,7 +1488,7 @@ endif
 # Dir ibase
 
 ifdef OBJECTDIRIBASE
-.PHONY:  ibase_all ibase_debug ibase_examples ibase_test ibase_smart ibase_shared ibase_showinstall ibase_install ibase_sourceinstall ibase_zipinstall ibase_zipsourceinstall ibase_clean ibase_distclean ibase_cleanall ibase_require ibase_info
+.PHONY:  ibase_all ibase_debug ibase_examples ibase_test ibase_smart ibase_shared ibase_showinstall ibase_install ibase_sourceinstall ibase_exampleinstall ibase_zipinstall ibase_zipsourceinstall ibase_zipexampleinstall ibase_clean ibase_distclean ibase_cleanall ibase_require ibase_info
 
 ibase_all:
 	$(MAKE) -C ibase all
@@ -1436,12 +1517,18 @@ ibase_install:
 ibase_sourceinstall:
 	$(MAKE) -C ibase sourceinstall
 
+ibase_exampleinstall:
+	$(MAKE) -C ibase exampleinstall
+
 ibase_zipinstall:
 	$(MAKE) -C ibase zipinstall
 
 ibase_zipsourceinstall:
 	$(MAKE) -C ibase zipsourceinstall
 
+ibase_zipexampleinstall:
+	$(MAKE) -C ibase zipexampleinstall
+
 ibase_clean:
 	$(MAKE) -C ibase clean
 
@@ -1461,7 +1548,7 @@ endif
 # Dir postgres
 
 ifdef OBJECTDIRPOSTGRES
-.PHONY:  postgres_all postgres_debug postgres_examples postgres_test postgres_smart postgres_shared postgres_showinstall postgres_install postgres_sourceinstall postgres_zipinstall postgres_zipsourceinstall postgres_clean postgres_distclean postgres_cleanall postgres_require postgres_info
+.PHONY:  postgres_all postgres_debug postgres_examples postgres_test postgres_smart postgres_shared postgres_showinstall postgres_install postgres_sourceinstall postgres_exampleinstall postgres_zipinstall postgres_zipsourceinstall postgres_zipexampleinstall postgres_clean postgres_distclean postgres_cleanall postgres_require postgres_info
 
 postgres_all:
 	$(MAKE) -C postgres all
@@ -1490,12 +1577,18 @@ postgres_install:
 postgres_sourceinstall:
 	$(MAKE) -C postgres sourceinstall
 
+postgres_exampleinstall:
+	$(MAKE) -C postgres exampleinstall
+
 postgres_zipinstall:
 	$(MAKE) -C postgres zipinstall
 
 postgres_zipsourceinstall:
 	$(MAKE) -C postgres zipsourceinstall
 
+postgres_zipexampleinstall:
+	$(MAKE) -C postgres zipexampleinstall
+
 postgres_clean:
 	$(MAKE) -C postgres clean
 
@@ -1515,7 +1608,7 @@ endif
 # Dir opengl
 
 ifdef OBJECTDIROPENGL
-.PHONY:  opengl_all opengl_debug opengl_examples opengl_test opengl_smart opengl_shared opengl_showinstall opengl_install opengl_sourceinstall opengl_zipinstall opengl_zipsourceinstall opengl_clean opengl_distclean opengl_cleanall opengl_require opengl_info
+.PHONY:  opengl_all opengl_debug opengl_examples opengl_test opengl_smart opengl_shared opengl_showinstall opengl_install opengl_sourceinstall opengl_exampleinstall opengl_zipinstall opengl_zipsourceinstall opengl_zipexampleinstall opengl_clean opengl_distclean opengl_cleanall opengl_require opengl_info
 
 opengl_all:
 	$(MAKE) -C opengl all
@@ -1544,12 +1637,18 @@ opengl_install:
 opengl_sourceinstall:
 	$(MAKE) -C opengl sourceinstall
 
+opengl_exampleinstall:
+	$(MAKE) -C opengl exampleinstall
+
 opengl_zipinstall:
 	$(MAKE) -C opengl zipinstall
 
 opengl_zipsourceinstall:
 	$(MAKE) -C opengl zipsourceinstall
 
+opengl_zipexampleinstall:
+	$(MAKE) -C opengl zipexampleinstall
+
 opengl_clean:
 	$(MAKE) -C opengl clean
 
@@ -1569,7 +1668,7 @@ endif
 # Dir forms
 
 ifdef OBJECTDIRFORMS
-.PHONY:  forms_all forms_debug forms_examples forms_test forms_smart forms_shared forms_showinstall forms_install forms_sourceinstall forms_zipinstall forms_zipsourceinstall forms_clean forms_distclean forms_cleanall forms_require forms_info
+.PHONY:  forms_all forms_debug forms_examples forms_test forms_smart forms_shared forms_showinstall forms_install forms_sourceinstall forms_exampleinstall forms_zipinstall forms_zipsourceinstall forms_zipexampleinstall forms_clean forms_distclean forms_cleanall forms_require forms_info
 
 forms_all:
 	$(MAKE) -C forms all
@@ -1598,12 +1697,18 @@ forms_install:
 forms_sourceinstall:
 	$(MAKE) -C forms sourceinstall
 
+forms_exampleinstall:
+	$(MAKE) -C forms exampleinstall
+
 forms_zipinstall:
 	$(MAKE) -C forms zipinstall
 
 forms_zipsourceinstall:
 	$(MAKE) -C forms zipsourceinstall
 
+forms_zipexampleinstall:
+	$(MAKE) -C forms zipexampleinstall
+
 forms_clean:
 	$(MAKE) -C forms clean
 
@@ -1623,7 +1728,7 @@ endif
 # Dir svgalib
 
 ifdef OBJECTDIRSVGALIB
-.PHONY:  svgalib_all svgalib_debug svgalib_examples svgalib_test svgalib_smart svgalib_shared svgalib_showinstall svgalib_install svgalib_sourceinstall svgalib_zipinstall svgalib_zipsourceinstall svgalib_clean svgalib_distclean svgalib_cleanall svgalib_require svgalib_info
+.PHONY:  svgalib_all svgalib_debug svgalib_examples svgalib_test svgalib_smart svgalib_shared svgalib_showinstall svgalib_install svgalib_sourceinstall svgalib_exampleinstall svgalib_zipinstall svgalib_zipsourceinstall svgalib_zipexampleinstall svgalib_clean svgalib_distclean svgalib_cleanall svgalib_require svgalib_info
 
 svgalib_all:
 	$(MAKE) -C svgalib all
@@ -1652,12 +1757,18 @@ svgalib_install:
 svgalib_sourceinstall:
 	$(MAKE) -C svgalib sourceinstall
 
+svgalib_exampleinstall:
+	$(MAKE) -C svgalib exampleinstall
+
 svgalib_zipinstall:
 	$(MAKE) -C svgalib zipinstall
 
 svgalib_zipsourceinstall:
 	$(MAKE) -C svgalib zipsourceinstall
 
+svgalib_zipexampleinstall:
+	$(MAKE) -C svgalib zipexampleinstall
+
 svgalib_clean:
 	$(MAKE) -C svgalib clean
 
@@ -1677,7 +1788,7 @@ endif
 # Dir ggi
 
 ifdef OBJECTDIRGGI
-.PHONY:  ggi_all ggi_debug ggi_examples ggi_test ggi_smart ggi_shared ggi_showinstall ggi_install ggi_sourceinstall ggi_zipinstall ggi_zipsourceinstall ggi_clean ggi_distclean ggi_cleanall ggi_require ggi_info
+.PHONY:  ggi_all ggi_debug ggi_examples ggi_test ggi_smart ggi_shared ggi_showinstall ggi_install ggi_sourceinstall ggi_exampleinstall ggi_zipinstall ggi_zipsourceinstall ggi_zipexampleinstall ggi_clean ggi_distclean ggi_cleanall ggi_require ggi_info
 
 ggi_all:
 	$(MAKE) -C ggi all
@@ -1706,12 +1817,18 @@ ggi_install:
 ggi_sourceinstall:
 	$(MAKE) -C ggi sourceinstall
 
+ggi_exampleinstall:
+	$(MAKE) -C ggi exampleinstall
+
 ggi_zipinstall:
 	$(MAKE) -C ggi zipinstall
 
 ggi_zipsourceinstall:
 	$(MAKE) -C ggi zipsourceinstall
 
+ggi_zipexampleinstall:
+	$(MAKE) -C ggi zipexampleinstall
+
 ggi_clean:
 	$(MAKE) -C ggi clean
 
@@ -1731,7 +1848,7 @@ endif
 # Dir utmp
 
 ifdef OBJECTDIRUTMP
-.PHONY:  utmp_all utmp_debug utmp_examples utmp_test utmp_smart utmp_shared utmp_showinstall utmp_install utmp_sourceinstall utmp_zipinstall utmp_zipsourceinstall utmp_clean utmp_distclean utmp_cleanall utmp_require utmp_info
+.PHONY:  utmp_all utmp_debug utmp_examples utmp_test utmp_smart utmp_shared utmp_showinstall utmp_install utmp_sourceinstall utmp_exampleinstall utmp_zipinstall utmp_zipsourceinstall utmp_zipexampleinstall utmp_clean utmp_distclean utmp_cleanall utmp_require utmp_info
 
 utmp_all:
 	$(MAKE) -C utmp all
@@ -1760,12 +1877,18 @@ utmp_install:
 utmp_sourceinstall:
 	$(MAKE) -C utmp sourceinstall
 
+utmp_exampleinstall:
+	$(MAKE) -C utmp exampleinstall
+
 utmp_zipinstall:
 	$(MAKE) -C utmp zipinstall
 
 utmp_zipsourceinstall:
 	$(MAKE) -C utmp zipsourceinstall
 
+utmp_zipexampleinstall:
+	$(MAKE) -C utmp zipexampleinstall
+
 utmp_clean:
 	$(MAKE) -C utmp clean
 
@@ -1785,7 +1908,7 @@ endif
 # Dir paszlib
 
 ifdef OBJECTDIRPASZLIB
-.PHONY:  paszlib_all paszlib_debug paszlib_examples paszlib_test paszlib_smart paszlib_shared paszlib_showinstall paszlib_install paszlib_sourceinstall paszlib_zipinstall paszlib_zipsourceinstall paszlib_clean paszlib_distclean paszlib_cleanall paszlib_require paszlib_info
+.PHONY:  paszlib_all paszlib_debug paszlib_examples paszlib_test paszlib_smart paszlib_shared paszlib_showinstall paszlib_install paszlib_sourceinstall paszlib_exampleinstall paszlib_zipinstall paszlib_zipsourceinstall paszlib_zipexampleinstall paszlib_clean paszlib_distclean paszlib_cleanall paszlib_require paszlib_info
 
 paszlib_all:
 	$(MAKE) -C paszlib all
@@ -1814,12 +1937,18 @@ paszlib_install:
 paszlib_sourceinstall:
 	$(MAKE) -C paszlib sourceinstall
 
+paszlib_exampleinstall:
+	$(MAKE) -C paszlib exampleinstall
+
 paszlib_zipinstall:
 	$(MAKE) -C paszlib zipinstall
 
 paszlib_zipsourceinstall:
 	$(MAKE) -C paszlib zipsourceinstall
 
+paszlib_zipexampleinstall:
+	$(MAKE) -C paszlib zipexampleinstall
+
 paszlib_clean:
 	$(MAKE) -C paszlib clean
 
@@ -1839,7 +1968,7 @@ endif
 # Dir gdbint
 
 ifdef OBJECTDIRGDBINT
-.PHONY:  gdbint_all gdbint_debug gdbint_examples gdbint_test gdbint_smart gdbint_shared gdbint_showinstall gdbint_install gdbint_sourceinstall gdbint_zipinstall gdbint_zipsourceinstall gdbint_clean gdbint_distclean gdbint_cleanall gdbint_require gdbint_info
+.PHONY:  gdbint_all gdbint_debug gdbint_examples gdbint_test gdbint_smart gdbint_shared gdbint_showinstall gdbint_install gdbint_sourceinstall gdbint_exampleinstall gdbint_zipinstall gdbint_zipsourceinstall gdbint_zipexampleinstall gdbint_clean gdbint_distclean gdbint_cleanall gdbint_require gdbint_info
 
 gdbint_all:
 	$(MAKE) -C gdbint all
@@ -1868,12 +1997,18 @@ gdbint_install:
 gdbint_sourceinstall:
 	$(MAKE) -C gdbint sourceinstall
 
+gdbint_exampleinstall:
+	$(MAKE) -C gdbint exampleinstall
+
 gdbint_zipinstall:
 	$(MAKE) -C gdbint zipinstall
 
 gdbint_zipsourceinstall:
 	$(MAKE) -C gdbint zipsourceinstall
 
+gdbint_zipexampleinstall:
+	$(MAKE) -C gdbint zipexampleinstall
+
 gdbint_clean:
 	$(MAKE) -C gdbint clean
 
@@ -1893,7 +2028,7 @@ endif
 # Dir cmem
 
 ifdef OBJECTDIRCMEM
-.PHONY:  cmem_all cmem_debug cmem_examples cmem_test cmem_smart cmem_shared cmem_showinstall cmem_install cmem_sourceinstall cmem_zipinstall cmem_zipsourceinstall cmem_clean cmem_distclean cmem_cleanall cmem_require cmem_info
+.PHONY:  cmem_all cmem_debug cmem_examples cmem_test cmem_smart cmem_shared cmem_showinstall cmem_install cmem_sourceinstall cmem_exampleinstall cmem_zipinstall cmem_zipsourceinstall cmem_zipexampleinstall cmem_clean cmem_distclean cmem_cleanall cmem_require cmem_info
 
 cmem_all:
 	$(MAKE) -C cmem all
@@ -1922,12 +2057,18 @@ cmem_install:
 cmem_sourceinstall:
 	$(MAKE) -C cmem sourceinstall
 
+cmem_exampleinstall:
+	$(MAKE) -C cmem exampleinstall
+
 cmem_zipinstall:
 	$(MAKE) -C cmem zipinstall
 
 cmem_zipsourceinstall:
 	$(MAKE) -C cmem zipsourceinstall
 
+cmem_zipexampleinstall:
+	$(MAKE) -C cmem zipexampleinstall
+
 cmem_clean:
 	$(MAKE) -C cmem clean
 
@@ -1947,7 +2088,7 @@ endif
 # Dir regexpr
 
 ifdef OBJECTDIRREGEXPR
-.PHONY:  regexpr_all regexpr_debug regexpr_examples regexpr_test regexpr_smart regexpr_shared regexpr_showinstall regexpr_install regexpr_sourceinstall regexpr_zipinstall regexpr_zipsourceinstall regexpr_clean regexpr_distclean regexpr_cleanall regexpr_require regexpr_info
+.PHONY:  regexpr_all regexpr_debug regexpr_examples regexpr_test regexpr_smart regexpr_shared regexpr_showinstall regexpr_install regexpr_sourceinstall regexpr_exampleinstall regexpr_zipinstall regexpr_zipsourceinstall regexpr_zipexampleinstall regexpr_clean regexpr_distclean regexpr_cleanall regexpr_require regexpr_info
 
 regexpr_all:
 	$(MAKE) -C regexpr all
@@ -1976,12 +2117,18 @@ regexpr_install:
 regexpr_sourceinstall:
 	$(MAKE) -C regexpr sourceinstall
 
+regexpr_exampleinstall:
+	$(MAKE) -C regexpr exampleinstall
+
 regexpr_zipinstall:
 	$(MAKE) -C regexpr zipinstall
 
 regexpr_zipsourceinstall:
 	$(MAKE) -C regexpr zipsourceinstall
 
+regexpr_zipexampleinstall:
+	$(MAKE) -C regexpr zipexampleinstall
+
 regexpr_clean:
 	$(MAKE) -C regexpr clean
 
@@ -2001,7 +2148,7 @@ endif
 # Dir zip
 
 ifdef OBJECTDIRZIP
-.PHONY:  zip_all zip_debug zip_examples zip_test zip_smart zip_shared zip_showinstall zip_install zip_sourceinstall zip_zipinstall zip_zipsourceinstall zip_clean zip_distclean zip_cleanall zip_require zip_info
+.PHONY:  zip_all zip_debug zip_examples zip_test zip_smart zip_shared zip_showinstall zip_install zip_sourceinstall zip_exampleinstall zip_zipinstall zip_zipsourceinstall zip_zipexampleinstall zip_clean zip_distclean zip_cleanall zip_require zip_info
 
 zip_all:
 	$(MAKE) -C zip all
@@ -2030,12 +2177,18 @@ zip_install:
 zip_sourceinstall:
 	$(MAKE) -C zip sourceinstall
 
+zip_exampleinstall:
+	$(MAKE) -C zip exampleinstall
+
 zip_zipinstall:
 	$(MAKE) -C zip zipinstall
 
 zip_zipsourceinstall:
 	$(MAKE) -C zip zipsourceinstall
 
+zip_zipexampleinstall:
+	$(MAKE) -C zip zipexampleinstall
+
 zip_clean:
 	$(MAKE) -C zip clean
 

+ 1 - 0
packages/Makefile.fpc

@@ -30,6 +30,7 @@ pkgs_go32v2=bas{paszlib,regexpr} \
 [install]
 packagename=packages
 sourcesubdirs=0
+examplesubdirs=1
 
 [sections]
 none=1

+ 84 - 36
packages/cmem/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -185,7 +185,7 @@ endif
 # Targets
 
 override UNITOBJECTS+=cmem
-override EXAMPLEOBJECTS+=testmem
+override EXAMPLEOBJECTS+=testcmem
 
 # Clean
 
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -1135,4 +1183,4 @@ endif
 # Users rules
 #####################################################################
 
-testmem$(EXEEXT): testmem.pp cmem$(PPUEXT)
+testcmem$(EXEEXT): testcmem.pp cmem$(PPUEXT)

+ 2 - 3
packages/cmem/Makefile.fpc

@@ -4,11 +4,10 @@
 
 [targets]
 units=cmem
-examples=testmem
+examples=testcmem
 
 [dirs]
 fpcdir=../..
 
-
 [rules]
-testmem$(EXEEXT): testmem.pp cmem$(PPUEXT)
+testcmem$(EXEEXT): testcmem.pp cmem$(PPUEXT)

+ 0 - 0
packages/cmem/testmem.pp → packages/cmem/testcmem.pp


+ 171 - 40
packages/forms/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -186,12 +186,14 @@ endif
 
 override UNITOBJECTS+=forms
 override EXEOBJECTS+=fd2pascal
+override EXAMPLEDIROBJECTS+=demo
 
 # Clean
 
 
 # Install
 
+EXAMPLESUBDIR=forms
 ZIPTARGET=install
 
 # Defaults
@@ -639,6 +641,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -674,12 +689,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -722,21 +743,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -779,6 +796,10 @@ all: fpc_all
 
 debug: fpc_debug
 
+examples: fpc_examples
+
+test: fpc_test
+
 smart: fpc_smart
 
 shared: fpc_shared
@@ -789,11 +810,15 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
-clean: fpc_clean
+zipexampleinstall: fpc_zipexampleinstall
+
+clean: fpc_clean $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
 
 distclean: fpc_distclean
 
@@ -801,7 +826,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -834,6 +859,24 @@ endif
 
 fpc_exes: $(EXEFILES)
 
+#####################################################################
+# Examples
+#####################################################################
+
+.PHONY: fpc_examples fpc_test
+
+ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
+
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+endif
+
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
+
+fpc_test: examples
+
 #####################################################################
 # General compile rules
 #####################################################################
@@ -876,6 +919,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -889,7 +938,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -907,14 +956,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -929,8 +971,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -953,9 +998,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -977,6 +1025,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1038,6 +1104,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1073,7 +1144,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -1150,16 +1221,76 @@ endif
 	@$(ECHO)
 
 #####################################################################
-# Local Makefile
+# Directories
 #####################################################################
 
-ifneq ($(wildcard fpcmake.loc),)
-include fpcmake.loc
+EXAMPLEDIRDEMO=1
+
+# Dir demo
+
+ifdef EXAMPLEDIRDEMO
+.PHONY:  demo_all demo_debug demo_examples demo_test demo_smart demo_shared demo_showinstall demo_install demo_sourceinstall demo_exampleinstall demo_zipinstall demo_zipsourceinstall demo_zipexampleinstall demo_clean demo_distclean demo_cleanall demo_require demo_info
+
+demo_all:
+	$(MAKE) -C demo all
+
+demo_debug:
+	$(MAKE) -C demo debug
+
+demo_examples:
+	$(MAKE) -C demo examples
+
+demo_test:
+	$(MAKE) -C demo test
+
+demo_smart:
+	$(MAKE) -C demo smart
+
+demo_shared:
+	$(MAKE) -C demo shared
+
+demo_showinstall:
+	$(MAKE) -C demo showinstall
+
+demo_install:
+	$(MAKE) -C demo install
+
+demo_sourceinstall:
+	$(MAKE) -C demo sourceinstall
+
+demo_exampleinstall:
+	$(MAKE) -C demo exampleinstall
+
+demo_zipinstall:
+	$(MAKE) -C demo zipinstall
+
+demo_zipsourceinstall:
+	$(MAKE) -C demo zipsourceinstall
+
+demo_zipexampleinstall:
+	$(MAKE) -C demo zipexampleinstall
+
+demo_clean:
+	$(MAKE) -C demo clean
+
+demo_distclean:
+	$(MAKE) -C demo distclean
+
+demo_cleanall:
+	$(MAKE) -C demo cleanall
+
+demo_require:
+	$(MAKE) -C demo require
+
+demo_info:
+	$(MAKE) -C demo info
 endif
 
 #####################################################################
-# Users rules
+# Local Makefile
 #####################################################################
 
-examples: all
-	$(MAKE) -C demo all
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+

+ 4 - 4
packages/forms/Makefile.fpc

@@ -5,13 +5,13 @@
 [targets]
 units=forms
 programs=fd2pascal
+exampledirs=demo
+
+[install]
+examplesubdir=forms
 
 [require]
 packages=x11
 
 [dirs]
 fpcdir=../..
-
-[rules]
-examples: all
-        $(MAKE) -C demo all

+ 83 - 36
packages/forms/demo/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -677,6 +677,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -712,17 +725,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add Other dirs path if asked
-ifdef OTHERLIBDIR
-override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -765,21 +779,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Add Other dirs path if asked
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -832,10 +847,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -844,7 +863,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -905,6 +924,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -918,7 +943,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -936,14 +961,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -958,8 +976,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -982,9 +1003,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1006,6 +1030,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1067,6 +1109,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1102,7 +1149,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 97 - 48
packages/gdbint/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -192,6 +192,7 @@ override EXAMPLEOBJECTS+=testgdb symify
 
 # Install
 
+EXAMPLESUBDIR=gdbint
 ZIPTARGET=install
 
 # Defaults
@@ -623,6 +624,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -658,30 +672,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
-endif
-
-ifdef NEEDLIBDIR
-override FPCOPT+=$(addprefix -Fl,$(NEEDLIBDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef NEEDOBJDIR
-override FPCOPT+=$(addprefix -Fo,$(NEEDOBJDIR))
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add GCC lib path if asked
-ifdef GCCLIBDIR
-override FPCOPT+=-Fl$(GCCLIBDIR)
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -724,21 +726,35 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef NEEDLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(NEEDLIBDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef NEEDOBJDIR
+override FPCOPT+=$(addprefix -Fo,$(NEEDOBJDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add GCC lib path if asked
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
+endif
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -793,10 +809,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -805,7 +825,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -828,13 +848,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -880,6 +901,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -893,7 +920,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -911,14 +938,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -933,8 +953,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -957,9 +980,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -981,6 +1007,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1042,6 +1086,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1077,7 +1126,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 3 - 0
packages/gdbint/Makefile.fpc

@@ -6,6 +6,9 @@
 units=gdbint gdbcon
 examples=testgdb symify
 
+[install]
+examplesubdir=gdbint
+
 [dirs]
 fpcdir=../..
 targetdir=.

+ 1 - 1
packages/gdbint/libgdb/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all

+ 82 - 34
packages/ggi/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 134 - 30
packages/gtk/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/06/03]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -185,12 +185,14 @@ endif
 # Targets
 
 override UNITOBJECTS+=glib gmodule gdk gtk
+override EXAMPLEDIROBJECTS+=examples
 
 # Clean
 
 
 # Install
 
+EXAMPLESUBDIR=gtk
 ZIPTARGET=install
 
 # Defaults
@@ -614,6 +616,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -761,6 +776,10 @@ all: fpc_all
 
 debug: fpc_debug
 
+examples: fpc_examples
+
+test: fpc_test
+
 smart: fpc_smart
 
 shared: fpc_shared
@@ -771,17 +790,23 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
+clean: fpc_clean $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+
 distclean: fpc_distclean
 
 cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -797,6 +822,24 @@ override CLEANPPUFILES+=$(UNITPPUFILES)
 
 fpc_units: $(UNITPPUFILES)
 
+#####################################################################
+# Examples
+#####################################################################
+
+.PHONY: fpc_examples fpc_test
+
+ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
+
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+endif
+
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
+
+fpc_test: examples
+
 #####################################################################
 # General compile rules
 #####################################################################
@@ -945,6 +988,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1006,6 +1067,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1117,6 +1183,72 @@ endif
 	@$(ECHO)  ZipName.............. $(ZIPNAME)
 	@$(ECHO)
 
+#####################################################################
+# Directories
+#####################################################################
+
+EXAMPLEDIREXAMPLES=1
+
+# Dir examples
+
+ifdef EXAMPLEDIREXAMPLES
+.PHONY:  examples_all examples_debug examples_examples examples_test examples_smart examples_shared examples_showinstall examples_install examples_sourceinstall examples_exampleinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_clean examples_distclean examples_cleanall examples_require examples_info
+
+examples_all:
+	$(MAKE) -C examples all
+
+examples_debug:
+	$(MAKE) -C examples debug
+
+examples_examples:
+	$(MAKE) -C examples examples
+
+examples_test:
+	$(MAKE) -C examples test
+
+examples_smart:
+	$(MAKE) -C examples smart
+
+examples_shared:
+	$(MAKE) -C examples shared
+
+examples_showinstall:
+	$(MAKE) -C examples showinstall
+
+examples_install:
+	$(MAKE) -C examples install
+
+examples_sourceinstall:
+	$(MAKE) -C examples sourceinstall
+
+examples_exampleinstall:
+	$(MAKE) -C examples exampleinstall
+
+examples_zipinstall:
+	$(MAKE) -C examples zipinstall
+
+examples_zipsourceinstall:
+	$(MAKE) -C examples zipsourceinstall
+
+examples_zipexampleinstall:
+	$(MAKE) -C examples zipexampleinstall
+
+examples_clean:
+	$(MAKE) -C examples clean
+
+examples_distclean:
+	$(MAKE) -C examples distclean
+
+examples_cleanall:
+	$(MAKE) -C examples cleanall
+
+examples_require:
+	$(MAKE) -C examples require
+
+examples_info:
+	$(MAKE) -C examples info
+endif
+
 #####################################################################
 # Local Makefile
 #####################################################################
@@ -1129,10 +1261,6 @@ endif
 # Users rules
 #####################################################################
 
-clean: fpc_clean
-	$(MAKE) -C examples clean
-	$(MAKE) -C tutorial clean
-
 glib$(PPUEXT): $(wildcard glib/glib*$(PASEXT))
 
 gmodule$(PPUEXT): $(wildcard glib/gmodule*$(PASEXT)) glib$(PPUEXT)
@@ -1140,27 +1268,3 @@ gmodule$(PPUEXT): $(wildcard glib/gmodule*$(PASEXT)) glib$(PPUEXT)
 gdk$(PPUEXT): $(wildcard gdk/gdk*$(PASEXT)) glib$(PPUEXT)
 
 gtk$(PPUEXT): $(wildcard gtk/gtk*$(PASEXT)) gdk$(PPUEXT)
-
-
-# Examples, tutorial
-
-.PHONY: examples tutorial installexamples
-
-examples: all
-	$(MAKE) -C examples
-
-tutorial: all
-	$(MAKE) -C tutorial
-
-ifndef EXAMPLESINSTALLDIR
-EXAMPLESINSTALLDIR=$(DOCINSTALLDIR)/examples
-endif
-ifndef TUTORIALINSTALLDIR
-TUTORIALINSTALLDIR=$(DOCINSTALLDIR)/tutorial
-endif
-
-installexamples:
-	$(MKDIR) $(EXAMPLESINSTALLDIR)
-	$(COPYTREE) examples/* $(EXAMPLESINSTALLDIR)
-	$(MKDIR) $(TUTORIALINSTALLDIR)
-	$(COPYTREE) tutorial/* $(TUTORIALINSTALLDIR)

+ 4 - 29
packages/gtk/Makefile.fpc

@@ -4,6 +4,10 @@
 
 [targets]
 units=glib gmodule gdk gtk
+exampledirs=examples
+
+[install]
+examplesubdir=gtk
 
 [dirs]
 fpcdir=../..
@@ -14,12 +18,7 @@ targetdir=.
 libname=libfpgtk.so
 libversion=1.0
 
-
 [rules]
-clean: fpc_clean
-        $(MAKE) -C examples clean
-        $(MAKE) -C tutorial clean
-
 glib$(PPUEXT): $(wildcard glib/glib*$(PASEXT))
 
 gmodule$(PPUEXT): $(wildcard glib/gmodule*$(PASEXT)) glib$(PPUEXT)
@@ -27,27 +26,3 @@ gmodule$(PPUEXT): $(wildcard glib/gmodule*$(PASEXT)) glib$(PPUEXT)
 gdk$(PPUEXT): $(wildcard gdk/gdk*$(PASEXT)) glib$(PPUEXT)
 
 gtk$(PPUEXT): $(wildcard gtk/gtk*$(PASEXT)) gdk$(PPUEXT)
-
-
-# Examples, tutorial
-
-.PHONY: examples tutorial installexamples
-
-examples: all
-        $(MAKE) -C examples
-
-tutorial: all
-        $(MAKE) -C tutorial
-
-ifndef EXAMPLESINSTALLDIR
-EXAMPLESINSTALLDIR=$(DOCINSTALLDIR)/examples
-endif
-ifndef TUTORIALINSTALLDIR
-TUTORIALINSTALLDIR=$(DOCINSTALLDIR)/tutorial
-endif
-
-installexamples:
-        $(MKDIR) $(EXAMPLESINSTALLDIR)
-        $(COPYTREE) examples/* $(EXAMPLESINSTALLDIR)
-        $(MKDIR) $(TUTORIALINSTALLDIR)
-        $(COPYTREE) tutorial/* $(TUTORIALINSTALLDIR)

+ 169 - 53
packages/gtk/examples/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -184,6 +184,7 @@ endif
 
 # Targets
 
+override DIROBJECTS+=$(wildcard tutorial)
 override EXEOBJECTS+=entry notebook scribble-simple clist ttt_test pixmap list progressbar
 
 # Clean
@@ -660,6 +661,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -695,27 +709,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
-endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-# Add GCC lib path if asked
-ifdef GCCLIBDIR
-override FPCOPT+=-Fl$(GCCLIBDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add Other dirs path if asked
-ifdef OTHERLIBDIR
-override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
 endif
-
-# Target dirs
-ifdef TARGETDIR
-override FPCOPT+=-FE$(TARGETDIR)
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -758,21 +763,32 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+# Add GCC lib path if asked
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Add Other dirs path if asked
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Target dirs
+ifdef TARGETDIR
+override FPCOPT+=-FE$(TARGETDIR)
+endif
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -811,33 +827,39 @@ endif
 # Standard rules
 #####################################################################
 
-all: fpc_all
+all: fpc_all $(addsuffix _all,$(DIROBJECTS))
 
-debug: fpc_debug
+debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS))
 
-smart: fpc_smart
+smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS))
 
-shared: fpc_shared
+shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS))
 
-showinstall: fpc_showinstall
+showinstall: fpc_showinstall $(addsuffix _showinstall,$(DIROBJECTS))
 
-install: fpc_install
+install: fpc_install $(addsuffix _install,$(DIROBJECTS))
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
-clean: fpc_clean
+zipexampleinstall: fpc_zipexampleinstall
+
+clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS))
 
-distclean: fpc_distclean
+distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS))
 
-cleanall: fpc_cleanall
+cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS))
+
+require: $(addsuffix _require,$(DIROBJECTS))
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info
 
 #####################################################################
 # Exes
@@ -898,6 +920,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -911,7 +939,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -929,14 +957,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -951,8 +972,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -975,9 +999,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -999,6 +1026,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1060,6 +1105,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1095,7 +1145,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -1171,6 +1221,72 @@ endif
 	@$(ECHO)  ZipName.............. $(ZIPNAME)
 	@$(ECHO)
 
+#####################################################################
+# Directories
+#####################################################################
+
+OBJECTDIRTUTORIAL=1
+
+# Dir tutorial
+
+ifdef OBJECTDIRTUTORIAL
+.PHONY:  tutorial_all tutorial_debug tutorial_examples tutorial_test tutorial_smart tutorial_shared tutorial_showinstall tutorial_install tutorial_sourceinstall tutorial_exampleinstall tutorial_zipinstall tutorial_zipsourceinstall tutorial_zipexampleinstall tutorial_clean tutorial_distclean tutorial_cleanall tutorial_require tutorial_info
+
+tutorial_all:
+	$(MAKE) -C tutorial all
+
+tutorial_debug:
+	$(MAKE) -C tutorial debug
+
+tutorial_examples:
+	$(MAKE) -C tutorial examples
+
+tutorial_test:
+	$(MAKE) -C tutorial test
+
+tutorial_smart:
+	$(MAKE) -C tutorial smart
+
+tutorial_shared:
+	$(MAKE) -C tutorial shared
+
+tutorial_showinstall:
+	$(MAKE) -C tutorial showinstall
+
+tutorial_install:
+	$(MAKE) -C tutorial install
+
+tutorial_sourceinstall:
+	$(MAKE) -C tutorial sourceinstall
+
+tutorial_exampleinstall:
+	$(MAKE) -C tutorial exampleinstall
+
+tutorial_zipinstall:
+	$(MAKE) -C tutorial zipinstall
+
+tutorial_zipsourceinstall:
+	$(MAKE) -C tutorial zipsourceinstall
+
+tutorial_zipexampleinstall:
+	$(MAKE) -C tutorial zipexampleinstall
+
+tutorial_clean:
+	$(MAKE) -C tutorial clean
+
+tutorial_distclean:
+	$(MAKE) -C tutorial distclean
+
+tutorial_cleanall:
+	$(MAKE) -C tutorial cleanall
+
+tutorial_require:
+	$(MAKE) -C tutorial require
+
+tutorial_info:
+	$(MAKE) -C tutorial info
+endif
+
 #####################################################################
 # Local Makefile
 #####################################################################

+ 1 - 0
packages/gtk/examples/Makefile.fpc

@@ -3,6 +3,7 @@
 #
 
 [targets]
+dirs=tutorial
 programs=entry notebook scribble-simple clist ttt_test pixmap list progressbar
 
 [require]

+ 82 - 34
packages/ibase/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 0 - 1
packages/ibase/Makefile.fpc

@@ -9,7 +9,6 @@ examples=testib40 testib60
 [dirs]
 fpcdir=../..
 
-
 [rules]
 testib40$(EXEEXT): testib40.pp ibase40$(PPUEXT)
 

+ 82 - 34
packages/inet/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 0 - 1
packages/inet/Makefile.fpc

@@ -9,7 +9,6 @@ examples=testinet pfinger
 [dirs]
 fpcdir=../..
 
-
 [rules]
 testinet$(EXEEXT): testinet$(PASEXT) inet$(PPUEXT)
 

+ 82 - 34
packages/mysql/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 0 - 1
packages/mysql/Makefile.fpc

@@ -9,7 +9,6 @@ examples=testdb
 [dirs]
 fpcdir=../..
 
-
 [rules]
 mysql$(PPUEXT): mysql$(PASEXT) mysql_com$(PPUEXT)
 

+ 83 - 34
packages/ncurses/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -192,6 +192,7 @@ override EXAMPLEOBJECTS+=firework testn ocrt_demo edit_demo
 
 # Install
 
+EXAMPLESUBDIR=ncurses
 ZIPTARGET=install
 
 # Defaults
@@ -609,6 +610,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +658,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +712,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +779,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +795,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +818,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +871,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +890,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +908,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +923,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +950,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +977,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1056,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1096,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 3 - 1
packages/ncurses/Makefile.fpc

@@ -6,10 +6,12 @@
 units=ncurses panel ncrt ocrt
 examples=firework testn ocrt_demo edit_demo
 
+[install]
+examplesubdir=ncurses
+
 [dirs]
 fpcdir=../..
 
-
 [rules]
 testn$(EXEEXT): testn$(PASEXT) ncurses$(PPUEXT)
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 855 - 71
packages/opengl/Makefile


+ 5 - 10
packages/opengl/Makefile.fpc

@@ -3,18 +3,13 @@
 #
 
 [targets]
-dirs=linux examples build
+dirs=linux build
+exampledirs=examples
 
-[sections]
-none=1
+[install]
+packagename=opengl
+examplesubdir=opengl
 
 [defaults]
 defaultbuilddir=$(OS_TARGET)
 defaultinstalldir=$(OS_TARGET)
-
-[rules]
-.PHONY: examples
-
-examples:
-        $(MAKE) examples_all
-

+ 80 - 33
packages/opengl/build/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -639,6 +639,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -674,12 +687,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -722,21 +741,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -789,10 +804,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -801,7 +820,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -876,6 +895,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -889,7 +914,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -907,14 +932,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -929,8 +947,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -953,9 +974,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -977,6 +1001,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1038,6 +1080,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1073,7 +1120,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 80 - 33
packages/opengl/build2/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all_units
@@ -639,6 +639,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -674,12 +687,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -722,21 +741,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -789,10 +804,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -801,7 +820,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -876,6 +895,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -889,7 +914,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -907,14 +932,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -929,8 +947,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -953,9 +974,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -977,6 +1001,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1038,6 +1080,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1073,7 +1120,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 36
packages/opengl/examples/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -677,6 +677,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -712,17 +725,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
 endif
-
-# Add Other dirs path if asked
-ifdef OTHERLIBDIR
-override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -765,21 +779,22 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+# Add Other dirs path if asked
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -832,10 +847,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -844,7 +863,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Exes
@@ -905,6 +924,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -918,7 +943,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -936,14 +961,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -958,8 +976,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -982,9 +1003,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -1006,6 +1030,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1067,6 +1109,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1102,7 +1149,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 80 - 33
packages/opengl/linux/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -644,6 +644,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -679,12 +692,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -727,21 +746,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -794,10 +809,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -806,7 +825,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -864,6 +883,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -877,7 +902,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -895,14 +920,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -917,8 +935,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -941,9 +962,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -965,6 +989,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1026,6 +1068,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1061,7 +1108,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 83 - 34
packages/paszlib/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -193,6 +193,7 @@ override EXAMPLEOBJECTS+=example minigzip
 # Install
 
 UNITSUBDIR=paszlib
+EXAMPLESUBDIR=paszlib
 ZIPTARGET=install
 
 # Defaults
@@ -610,6 +611,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -645,12 +659,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -693,21 +713,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -764,10 +780,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -776,7 +796,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -799,13 +819,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -851,6 +872,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -864,7 +891,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -882,14 +909,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -904,8 +924,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -928,9 +951,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -952,6 +978,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1013,6 +1057,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1048,7 +1097,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 1
packages/paszlib/Makefile.fpc

@@ -8,7 +8,7 @@ examples=example minigzip
 
 [install]
 unitsubdir=paszlib
-sourcesubdir=packages
+examplesubdir=paszlib
 
 [dirs]
 fpcdir=../..

+ 3 - 3
packages/paszlib/example.pas

@@ -27,7 +27,7 @@ uses
   SysUtils,
 {$endif}
   zutil,
-  zLib,
+  zbase,
   gzIo,
   zInflate,
   zDeflate,
@@ -548,10 +548,10 @@ begin
       if (d_stream.adler <> dictId) then
       begin
         WriteLn('unexpected dictionary');
-	Stop;
+        Stop;
       end;
       err := inflateSetDictionary(d_stream, pBytef(dictionary),
-				     StrLen(dictionary));
+                                     StrLen(dictionary));
     end;
     CHECK_ERR(err, 'inflate with dict');
   end;

+ 83 - 35
packages/postgres/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -185,7 +185,7 @@ endif
 # Targets
 
 override UNITOBJECTS+=dllist postgres
-override EXAMPLEOBJECTS+=testpg testemail
+override EXAMPLEOBJECTS+=testpg1 testpg2
 
 # Clean
 
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 1
packages/postgres/Makefile.fpc

@@ -4,7 +4,7 @@
 
 [targets]
 units=dllist postgres
-examples=testpg testemail
+examples=testpg1 testpg2
 
 [dirs]
 fpcdir=../..

+ 0 - 0
packages/postgres/testpg.pp → packages/postgres/testpg1.pp


+ 0 - 0
packages/postgres/testemail.pp → packages/postgres/testpg2.pp


+ 83 - 35
packages/regexpr/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -185,7 +185,7 @@ endif
 # Targets
 
 override UNITOBJECTS+=regexpr
-override EXAMPLEOBJECTS+=test1
+override EXAMPLEOBJECTS+=testreg1
 
 # Clean
 
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 4
packages/regexpr/Makefile.fpc

@@ -4,10 +4,7 @@
 
 [targets]
 units=regexpr
-examples=test1
-
-[install]
-sourcesubdir=packages
+examples=testreg1
 
 [dirs]
 fpcdir=../..

+ 82 - 34
packages/svgalib/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 82 - 34
packages/syslog/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 1 - 4
packages/syslog/Makefile.fpc

@@ -1,13 +1,10 @@
 #
-#   Makefile.fpc for CGI Units
+#   Makefile.fpc for SysLog Units
 #
 
 [targets]
 units=systemlog
 examples=testlog
 
-[install]
-sourcesubdir=packages
-
 [dirs]
 fpcdir=../..

+ 82 - 34
packages/uncgi/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 0 - 3
packages/uncgi/Makefile.fpc

@@ -6,8 +6,5 @@
 units=uncgi
 examples=testcgi
 
-[install]
-sourcesubdir=packages
-
 [dirs]
 fpcdir=../..

+ 84 - 36
packages/utmp/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -185,7 +185,7 @@ endif
 # Targets
 
 override UNITOBJECTS+=utmp
-override EXAMPLEOBJECTS+=testu
+override EXAMPLEOBJECTS+=testutmp
 
 # Clean
 
@@ -609,6 +609,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -644,12 +657,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -692,21 +711,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -763,10 +778,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -775,7 +794,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -798,13 +817,14 @@ fpc_units: $(UNITPPUFILES)
 .PHONY: fpc_examples fpc_test
 
 ifdef EXAMPLEOBJECTS
+override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
 override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
 
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 endif
 
-fpc_examples: all $(EXAMPLEFILES)
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS))
 
 fpc_test: examples
 
@@ -850,6 +870,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -863,7 +889,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -881,14 +907,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -903,8 +922,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -927,9 +949,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -951,6 +976,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -1012,6 +1055,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1047,7 +1095,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -1135,4 +1183,4 @@ endif
 # Users rules
 #####################################################################
 
-testu$(EXEEXT): testu$(PASEXT) utmp$(PPUEXT)
+testutmp$(EXEEXT): testutmp$(PASEXT) utmp$(PPUEXT)

+ 2 - 3
packages/utmp/Makefile.fpc

@@ -4,11 +4,10 @@
 
 [targets]
 units=utmp
-examples=testu
+examples=testutmp
 
 [dirs]
 fpcdir=../..
 
-
 [rules]
-testu$(EXEEXT): testu$(PASEXT) utmp$(PPUEXT)
+testutmp$(EXEEXT): testutmp$(PASEXT) utmp$(PPUEXT)

+ 0 - 0
packages/utmp/testu.pp → packages/utmp/testutmp.pp


+ 80 - 33
packages/x11/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -608,6 +608,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -643,12 +656,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -691,21 +710,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -758,10 +773,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -770,7 +789,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -828,6 +847,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -841,7 +866,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -859,14 +884,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -881,8 +899,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -905,9 +926,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -929,6 +953,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -990,6 +1032,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1025,7 +1072,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

+ 80 - 34
packages/zip/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -611,6 +611,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -646,12 +659,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -694,21 +713,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -761,10 +776,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -773,7 +792,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -831,6 +850,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -844,7 +869,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -862,14 +887,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -884,8 +902,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -908,9 +929,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -932,6 +956,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -993,6 +1035,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1028,7 +1075,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 
@@ -1116,7 +1163,6 @@ endif
 # Users rules
 #####################################################################
 
-
 unzip$(PPUEXT): unzip$(PASEXT) ziptypes$(PPUEXT)
 
 unzipdll$(PPUEXT):  unzipdll$(PASEXT) ziptypes$(PPUEXT)

+ 0 - 1
packages/zip/Makefile.fpc

@@ -10,7 +10,6 @@ units_os2=unzipdll
 fpcdir=../..
 
 [rules]
-
 unzip$(PPUEXT): unzip$(PASEXT) ziptypes$(PPUEXT)
 
 unzipdll$(PPUEXT):  unzipdll$(PASEXT) ziptypes$(PPUEXT)

+ 80 - 33
packages/zlib/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.15 [2000/05/26]
+# Makefile generated by fpcmake v0.99.15 [2000/07/02]
 #
 
 defaultrule: all
@@ -608,6 +608,19 @@ DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
 
+# Where to install the examples, under linux we use the doc dir
+# because the copytree command will create a subdir itself
+ifndef EXAMPLEINSTALLDIR
+ifdef inlinux
+EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
+else
+EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+
 # Where the some extra (data)files will be stored
 ifndef DATAINSTALLDIR
 DATAINSTALLDIR=$(BASEINSTALLDIR)
@@ -643,12 +656,18 @@ ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
 
-ifdef NEEDUNITDIR
-override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+# User dirs should be first, so they are looked at first
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
-
-ifdef UNITSDIR
-override FPCOPT+=-Fu$(UNITSDIR)
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
 endif
 
 # Smartlinking
@@ -691,21 +710,17 @@ ifdef VERBOSE
 override FPCOPT+=-vwni
 endif
 
-# Add commandline options
-ifdef OPT
-override FPCOPT+=$(OPT)
-endif
-ifdef UNITDIR
-override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
-endif
-ifdef LIBDIR
-override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
 endif
-ifdef OBJDIR
-override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
 endif
-ifdef INCDIR
-override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+
+# Add commandline options last so they can override
+ifdef OPT
+override FPCOPT+=$(OPT)
 endif
 
 # Add defines from FPCOPTDEF to FPCOPT
@@ -758,10 +773,14 @@ install: fpc_install
 
 sourceinstall: fpc_sourceinstall
 
+exampleinstall: fpc_exampleinstall
+
 zipinstall: fpc_zipinstall
 
 zipsourceinstall: fpc_zipsourceinstall
 
+zipexampleinstall: fpc_zipexampleinstall
+
 clean: fpc_clean
 
 distclean: fpc_distclean
@@ -770,7 +789,7 @@ cleanall: fpc_cleanall
 
 info: fpc_info
 
-.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+.PHONY:  all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info
 
 #####################################################################
 # Units
@@ -828,6 +847,12 @@ fpc_debug:
 
 .PHONY: fpc_smart fpc_shared
 
+ifdef LIBVERSION
+LIBFULLNAME=$(LIBNAME).$(LIBVERSION)
+else
+LIBFULLNAME=$(LIBNAME)
+endif
+
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
@@ -841,7 +866,7 @@ ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
-	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)
 endif
 else
 	@$(ECHO) "Shared Libraries not supported"
@@ -859,14 +884,7 @@ endif
 
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
-ifdef inlinux
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-ifdef LIBNAME
-INSTALLPPULIBFILES=$(LIBNAME)
-endif
-else
-INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
-endif
 else
 INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
@@ -881,8 +899,11 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
 endif
-ifneq ($(INSTALLPPULIBFILES),)
-	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+ifneq ($(wildcard $(LIBFULLNAME)),)
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
+ifdef inlinux
+	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -905,9 +926,12 @@ ifdef INSTALLPPUFILES
 ifneq ($(INSTALLPPULINKFILES),)
 	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifneq ($(INSTALLPPULIBFILES),)
+ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
-	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
+ifdef inlinux
+	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
+endif
 endif
 endif
 ifdef EXTRAINSTALLFILES
@@ -929,6 +953,24 @@ fpc_sourceinstall: clean
 	$(MKDIR) $(SOURCEINSTALLDIR)
 	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
 
+#####################################################################
+# exampleinstall rules
+#####################################################################
+
+.PHONY: fpc_exampleinstall
+
+fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))
+ifdef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+	$(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)
+endif
+ifdef EXAMPLEDIROBJECTS
+ifndef EXAMPLESOURCEFILES
+	$(MKDIR) $(EXAMPLEINSTALLDIR)
+endif
+	$(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR)
+endif
+
 #####################################################################
 # Zip
 #####################################################################
@@ -990,6 +1032,11 @@ endif
 fpc_zipsourceinstall:
 	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
 
+.PHONY:  fpc_zipexampleinstall
+
+fpc_zipexampleinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm
+
 #####################################################################
 # Clean rules
 #####################################################################
@@ -1025,7 +1072,7 @@ ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
 endif
 ifdef LIBNAME
-	-$(DEL) $(LIBNAME)
+	-$(DEL) $(LIBNAME) $(LIBFULLNAME)
 endif
 	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
 

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott