Makefile improvements related to clean, dmake and man targets.

This commit is contained in:
Reijo Tomperi 2010-09-22 21:25:27 +03:00
parent 3f79faac2a
commit 8a7989c824
2 changed files with 13 additions and 9 deletions

View File

@ -88,7 +88,7 @@ TESTOBJ = test/testautovariables.o \
cppcheck: $(LIBOBJ) $(CLIOBJ)
$(CXX) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(LDFLAGS)
all: cppcheck testrunner tools
all: cppcheck testrunner
testrunner: $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cmdlineparser.o
$(CXX) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cmdlineparser.o $(LDFLAGS)
@ -96,13 +96,16 @@ testrunner: $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cmdlineparser.o
test: all
./testrunner
dmake:
dmake: tools/dmake.cpp
$(CXX) -o dmake tools/dmake.cpp lib/filelister*.cpp
clean:
rm -f lib/*.o cli/*.o test/*.o testrunner cppcheck
rm -f lib/*.o cli/*.o test/*.o testrunner cppcheck cppcheck.1
man: man/cppcheck.1
man/cppcheck.1: $(MAN_SOURCE)
man: $(MAN_SOURCE)
$(XP) $(DB2MAN) $(MAN_SOURCE)
install: cppcheck
@ -142,7 +145,7 @@ lib/checkunusedfunctions.o: lib/checkunusedfunctions.cpp lib/checkunusedfunction
lib/cppcheck.o: lib/cppcheck.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/preprocessor.h lib/filelister.h lib/path.h lib/timer.h
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/cppcheck.o lib/cppcheck.cpp
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/path.h
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/filelister.h lib/path.h
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/errorlogger.o lib/errorlogger.cpp
lib/executionpath.o: lib/executionpath.cpp lib/executionpath.h lib/token.h

View File

@ -220,19 +220,20 @@ int main(int argc, char **argv)
fout << "\n###### Targets\n\n";
fout << "cppcheck:\t$(LIBOBJ)\t$(CLIOBJ)\n";
fout << "\t$(CXX) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(LDFLAGS)\n\n";
fout << "all:\tcppcheck\ttestrunner\ttools\n\n";
fout << "all:\tcppcheck\ttestrunner\n\n";
fout << "testrunner:\t$(TESTOBJ)\t$(LIBOBJ)\tcli/threadexecutor.o\tcli/cmdlineparser.o\n";
fout << "\t$(CXX) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cmdlineparser.o $(LDFLAGS)\n\n";
fout << "test:\tall\n";
fout << "\t./testrunner\n\n";
fout << "dmake:\n";
fout << "dmake:\ttools/dmake.cpp\n";
fout << "\t$(CXX) -o dmake tools/dmake.cpp lib/filelister*.cpp\n\n";
fout << "clean:\n";
#ifdef _WIN32
fout << "\tdel lib\*.o\n\tdel cli\*.o\n\tdel test\*.o\n\tdel *.exe\n";
#else
fout << "\trm -f lib/*.o cli/*.o test/*.o testrunner cppcheck\n\n";
fout << "man:\t$(MAN_SOURCE)\n";
fout << "\trm -f lib/*.o cli/*.o test/*.o testrunner cppcheck cppcheck.1\n\n";
fout << "man:\tman/cppcheck.1\n\n";
fout << "man/cppcheck.1:\t$(MAN_SOURCE)\n\n";
fout << "\t$(XP) $(DB2MAN) $(MAN_SOURCE)\n\n";
fout << "install:\tcppcheck\n";
fout << "\tinstall -d ${BIN}\n";