summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorengelsman <engelsman>2009-03-09 20:58:27 +0000
committerengelsman <engelsman>2009-03-09 20:58:27 +0000
commit21b66924761abd99b1b7814ab14fb2783226ed32 (patch)
tree4755bb631ffed2a41e60fc4e9764eecd352a0712
parent7e83e8e4afbde752b322927a45f00ca95af1f607 (diff)
basics.dox: added example Makefile using fltk-config (STR #2149)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6673 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--documentation/src/basics.dox38
1 files changed, 38 insertions, 0 deletions
diff --git a/documentation/src/basics.dox b/documentation/src/basics.dox
index bbe94756c..b22b7494c 100644
--- a/documentation/src/basics.dox
+++ b/documentation/src/basics.dox
@@ -289,6 +289,44 @@ fltk-config --use-forms --use-gl --use-images --compile filename.cpp
Any of these will create an executable named <tt>filename</tt>.
+\section basics_makefile Compiling Programs with Makefiles
+
+The previous section described how to use <tt>fltk-config</tt> to
+build a program consisting of a single source file from the command
+line, and this is very convenient for small test programs.
+But <tt>fltk-config</tt> can also be used to set the compiler and
+linker options as variables within a <tt>Makefile</tt> that can be
+used to build programs out of multiple source files:
+
+\code
+CXX = $(shell fltk-config --cxx)
+DEBUG = -g
+CXXFLAGS = $(shell fltk-config --use-gl --use-images --cxxflags ) -I.
+LDFLAGS = $(shell fltk-config --use-gl --use-images --ldflags )
+LDSTATIC = $(shell fltk-config --use-gl --use-images --ldstaticflags )
+LINK = $(CXX)
+
+TARGET = cube
+OBJS = CubeMain.o CubeView.o CubeViewUI.o
+SRCS = CubeMain.cxx CubeView.cxx CubeViewUI.cxx
+
+.SUFFIXES: .o .cxx
+%.o: %.cxx
+ $(CXX) $(CXXFLAGS) $(DEBUG) -c $<
+
+all: $(TARGET)
+ $(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)
+
+$(TARGET): $(OBJS)
+CubeMain.o: CubeMain.cxx CubeViewUI.h
+CubeView.o: CubeView.cxx CubeView.h CubeViewUI.h
+CubeViewUI.o: CubeViewUI.cxx CubeView.h
+
+clean: $(TARGET) $(OBJS)
+ rm -f *.o 2> /dev/null
+ rm -f $(TARGET) 2> /dev/null
+\endcode
+
\section basics_visual_cpp Compiling Programs with Microsoft Visual C++
In Visual C++ you will need to tell the compiler where to