From: Robert Roebling Date: Sat, 5 Sep 1998 13:59:23 +0000 (+0000) Subject: Makefile next attempt X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f3cb6592e97f338d6546d42588e9af7cbb8e1bd0 Makefile next attempt git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/.cvsignore b/.cvsignore index a4555c2e92..47bc8bb59d 100644 --- a/.cvsignore +++ b/.cvsignore @@ -2,7 +2,8 @@ system.list bin .gdb_history Test -config.cashe +config.cache config.status system.list -linux.system.cashe \ No newline at end of file +linux.system.cache +wx-config diff --git a/configure b/configure index 792f25a624..67440e6043 100755 --- a/configure +++ b/configure @@ -106,9 +106,9 @@ ac_help="$ac_help ac_help="$ac_help **--with-printarch use printing architecture" ac_help="$ac_help -**--with-gtk-prefix=PFX Prefix where GTK is installed" +**--with-gtk-prefix=PFX Prefix where GTK is installed" ac_help="$ac_help -**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed" +**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed" ac_help="$ac_help **--without-threads Force disabling threads " @@ -6881,7 +6881,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "./setup/substit ./include/wx/gtk/setup.h:./setup/setup.hin" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "./setup/substit ./wx-config:./wx-config.in ./include/wx/gtk/setup.h:./setup/setup.hin" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 230bcbdcb8..5cb887560b 100644 --- a/configure.in +++ b/configure.in @@ -14,9 +14,9 @@ AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl -AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed], +AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed], gtk_config_prefix="$withval", gtk_config_prefix="") -AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed], +AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") if test x$gtk_config_exec_prefix != x ; then @@ -1547,6 +1547,6 @@ dnl add OS to list of configured echo $OS >> system.list AC_CONFIG_HEADER(./include/wx/gtk/setup.h:./setup/setup.hin) -AC_OUTPUT(./setup/substit,./setup/general/createall) +AC_OUTPUT(./setup/substit ./wx-config:./wx-config.in,./setup/general/createall) AC_OVERRIDES_DONE diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index 0eb9f235a2..05daf515a8 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -17,7 +17,7 @@ Unix that comes with Posix threads or SGI threads. Now create your super-application myfoo.app and compile anywhere with -gcc -o -c myfoo.cpp -I/usr/local/include -L/usr/local/lib -lwx_gtk +g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo * General ----------------------- @@ -256,10 +256,34 @@ will do the work for you. * Creating a new Project -------------------------- -There are two ways to create your own project. The first creates -a project within the source code directories of wxWindows: In this -case I propose to put all contributed programs in the directory -"/user", with a directory of its own. +There are two ways to create your own project: + +1) The first way uses the installed libraries and header files +automatically using wx-config + +g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo + +Using this way, a make file for the minimal sample would look +like this + +CC = g++ + +minimal: minimal.o + $(CC) -o minimal minimal.o `wx-config --libs` + +minimal.o: minimal.cpp mondrian.xpm + $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o + +clean: + rm -f *.o minimal + +This is certain to become the standard way unless we decide +to sitch to tmake. + +2) The other way creates a project within the source code +directories of wxWindows: In this case I propose to put +all contributed programs in the directory "/user", with a +directory of its own. This directory then should include the following files: @@ -274,12 +298,6 @@ Makefile.in (This is the base application-Makefile template, from put ALL your source code along with all the other stuff you need for your application in this directory (subdirectories are welcome). -The other way uses the installed libraries and header files in -/usr/local/include/wx and /usr/local/lib. In this case, just -compile your program like this: - -gcc -o -c myfoo.cpp -I/usr/local/include -L/usr/local/lib -lwx_gtk - ** Something about Makefiles ------------------------------ diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 689f30ce9f..7baf8849f3 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -25,17 +25,6 @@ // classes //----------------------------------------------------------------------------- -class wxDC; -class wxPaintDC; -class wxMemoryDC; -class wxToolBar; -class wxBitmapButton; -class wxStaticBitmap; -class wxFrame; -class wxDialog; -class wxTreeCtrl; -class wxNotebook; - class wxMask; class wxBitmap; @@ -55,19 +44,8 @@ class wxMask: public wxObject wxMask( const wxBitmap& bitmap ); ~wxMask(); - private: - - friend wxBitmap; - friend wxDC; - friend wxPaintDC; - friend wxToolBar; - friend wxBitmapButton; - friend wxStaticBitmap; - friend wxFrame; - friend wxDialog; - friend wxTreeCtrl; - friend wxNotebook; - + // implementation + GdkBitmap *GetBitmap() const; protected: @@ -118,11 +96,12 @@ class wxBitmap: public wxObject wxPalette *GetPalette() const; wxPalette *GetColourMap() const { return GetPalette(); }; + + // implementation GdkPixmap *GetPixmap() const; GdkBitmap *GetBitmap() const; - private: void DestroyImage(); void RecreateImage(); void Render(); diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 689f30ce9f..7baf8849f3 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -25,17 +25,6 @@ // classes //----------------------------------------------------------------------------- -class wxDC; -class wxPaintDC; -class wxMemoryDC; -class wxToolBar; -class wxBitmapButton; -class wxStaticBitmap; -class wxFrame; -class wxDialog; -class wxTreeCtrl; -class wxNotebook; - class wxMask; class wxBitmap; @@ -55,19 +44,8 @@ class wxMask: public wxObject wxMask( const wxBitmap& bitmap ); ~wxMask(); - private: - - friend wxBitmap; - friend wxDC; - friend wxPaintDC; - friend wxToolBar; - friend wxBitmapButton; - friend wxStaticBitmap; - friend wxFrame; - friend wxDialog; - friend wxTreeCtrl; - friend wxNotebook; - + // implementation + GdkBitmap *GetBitmap() const; protected: @@ -118,11 +96,12 @@ class wxBitmap: public wxObject wxPalette *GetPalette() const; wxPalette *GetColourMap() const { return GetPalette(); }; + + // implementation GdkPixmap *GetPixmap() const; GdkBitmap *GetBitmap() const; - private: void DestroyImage(); void RecreateImage(); void Render(); diff --git a/setup/maketmpl.in b/setup/maketmpl.in index 25051c1aff..9c6592865d 100644 --- a/setup/maketmpl.in +++ b/setup/maketmpl.in @@ -61,18 +61,18 @@ DJPEG_PROG = GIFTOPNM_PROG = NETPBM_PATH = +# Base directories for installation prefix = @prefix@ exec_prefix = @exec_prefix@ -# Directory in which to install scripts. -#bindir = @bindir@ +# Directory in which to install headers +includedir = @includedir@ -# Directory in which to install library files. -datadir = @datadir@ -acdatadir = $(datadir)/autoconf +# Directory in which to install library files +libdir = @libdir@ -# Directory in which to install documentation info files. -infodir = @infodir@ +# Directory in which to install executable files +bindir = @bindir@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ diff --git a/setup/substit.in b/setup/substit.in index cce03fde09..ad28b81a66 100644 --- a/setup/substit.in +++ b/setup/substit.in @@ -25,9 +25,9 @@ s|*AWK*|@AWK@|g s|*LN_S*|@LN_S@|g s|*prefix*|@prefix@|g s|*exec_prefix*|@exec_prefix@|g +s|*libdir*|@libdir@|g s|*bindir*|@bindir@|g -s|*datadir*|@datadir@|g -s|*infodir*|@infodir@|g +s|*includedir*|@includedir@|g s|*X_CFLAGS*|@X_CFLAGS@|g s|*X_LIBS*|@X_LIBS@|g s|*X_EXTRA_LIBS*|@X_EXTRA_LIBS@|g diff --git a/src/Makefile.in b/src/Makefile.in index c9dac31733..0f3b3378aa 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -18,6 +18,10 @@ RULE=gslib # include gtk.inc, qt.inc or motif.inc here include @MAKEINCLUDE@ +# determine library names +STATIC_LIBRARY=lib$(LIB_TARGET).a +SHARED_LIBRARY=lib$(LIB_TARGET).so.$(LIB_MAJOR).$(LIB_MINOR) + LIB_CPP_ALL_SRC=$(LIB_CPP_SRC) @GTK_JOYSTICK@ @UNIX_THREAD@ LIB_C_ALL_SRC=$(LIB_C_SRC) parser.c @@ -39,7 +43,9 @@ all:: @if test ! -d iodbc; then mkdir iodbc; fi install:: + @echo " " @echo "Installing library files and headers.." + @echo " " @echo " Creating directories.." @$(WXBASEDIR)/mkinstalldirs \ /usr/local/include/wx \ @@ -49,33 +55,37 @@ install:: @echo " Copying headers from /include/wx" @cd $(WXBASEDIR)/include/wx ; \ for f in *.h ; do \ - rm -f /usr/local/include/wx/$$f ; \ - $(INSTALL_DATA) $$f /usr/local/include/wx/$$f ; \ + rm -f $(includedir)/wx/$$f ; \ + $(INSTALL_DATA) $$f $(includedir)/wx/$$f ; \ done @echo " Copying headers from /include/wx/gtk" @cd $(WXBASEDIR)/include/wx/gtk ; \ for f in *.h ; do \ - rm -f /usr/local/include/wx/gtk/$$f ; \ - $(INSTALL_DATA) $$f /usr/local/include/wx/gtk/$$f ; \ + rm -f $(includedir)/wx/gtk/$$f ; \ + $(INSTALL_DATA) $$f $(includedir)/wx/gtk/$$f ; \ done @echo " Copying headers from /include/wx/generic" @cd $(WXBASEDIR)/include/wx/generic ; \ for f in *.h ; do \ - rm -f /usr/local/include/wx/generic/$$f ; \ - $(INSTALL_DATA) $$f /usr/local/include/wx/generic/$$f ; \ + rm -f $(includedir)/wx/generic/$$f ; \ + $(INSTALL_DATA) $$f $(includedir)/wx/generic/$$f ; \ done - @echo " Copying static libraries files to /usr/local/lib" + @echo " Copying wx-config" + @cd $(WXBASEDIR) ; \ + rm -f $(bindir)/wx-config ; \ + $(INSTALL_PROGRAM) wx-config $(bindir)/wx-config + @echo " Copying static library" @cd $(WXBASEDIR)/lib/$(OS) ; \ - for f in libwx_gtk.a ; do \ - rm -f /usr/local/lib/$$f ; \ - $(INSTALL_DATA) $$f /usr/local/lib/$$f ; \ - done - @echo " Copying shared libraries to /usr/local/lib" + rm -f $(libdir)/$(STATIC_LIBRARY) ; \ + $(INSTALL_DATA) $(STATIC_LIBRARY) $(libdir)/$(STATIC_LIBRARY) + @echo " Copying shared library" @cd $(WXBASEDIR)/lib/$(OS) ; \ - for f in libwx_gtk.so* ; do \ - rm -f /usr/local/lib/$$f ; \ - $(INSTALL_PROGRAM) $$f /usr/local/lib/$$f ; \ - done + rm -f $(libdir)/$(SHARED_LIBRARY) ; \ + $(INSTALL_PROGRAM) $(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) + @echo " " + @echo "Installation complete. You may have to run ldconfig!" + @echo " " + clean:: $(RM) -rf gtk diff --git a/wx-config.in b/wx-config.in new file mode 100755 index 0000000000..21b379e1b5 --- /dev/null +++ b/wx-config.in @@ -0,0 +1,57 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage="\ +Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @WXGTK_VERSION@ + ;; + --cflags) + if test @includedir@ != /usr/include ; then + includes=-I@includedir@ + fi + echo $includes -D@TOOLKIT_DEF@ @GUI_TK_INCLUDE@ + ;; + --libs) + echo -L@libdir@ -lwx_gtk -ldl @GUI_TK_LIBRARY@ @THREADS_LINK@ @EXTRA_LINK@ + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done +