|
|
Author: engelsman
Date: 2009-03-09 13:58:27 -0700 (Mon, 09 Mar 2009)
New Revision: 6673
Log:
basics.dox: added example Makefile using fltk-config (STR #2149)
Modified:
branches/branch-1.3/documentation/src/basics.dox
Modified: branches/branch-1.3/documentation/src/basics.dox
===================================================================
--- branches/branch-1.3/documentation/src/basics.dox 2009-03-07 15:15:29 UTC (rev 6672)
+++ branches/branch-1.3/documentation/src/basics.dox 2009-03-09 20:58:27 UTC (rev 6673)
@@ -289,6 +289,44 @@
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
[ Direct Link to Message ] | |
|
| |