Fix Makefile example in chapter "FLTK Basics"

- move linker rule from 'all' to '$(TARGET)'
- remove '$(TARGET) $(OBJS)' from rule 'clean'

The 'clean' rule required to build everything before it was deleted
which was obviously not intended.
This commit is contained in:
Albrecht Schlosser 2024-11-26 16:03:07 +01:00
parent 2430cb1f42
commit 9bac964f85

View File

@ -453,24 +453,27 @@ 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
OBJS = CubeMain.o CubeView.o CubeViewUI.o
SRCS = CubeMain.cxx CubeView.cxx CubeViewUI.cxx
.SUFFIXES: .o .cxx
%.o: %.cxx
$(CXX) $(CXXFLAGS) $(DEBUG) -c $<
$(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
$(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)
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
clean:
rm -f *.o 2> /dev/null
rm -f $(TARGET) 2> /dev/null
\endcode
\subsection basics_visual_cpp Compiling Programs with Microsoft Visual C++