Advertisement
Guest User

Untitled

a guest
Oct 8th, 2013
2,724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. # $Id: Makefile,v 1.4 2008/03/08$
  2. #
  3. # Authors: Christopher Dyken, <erikd at ifi.uio.no>
  4. # Tom Fredrik Klaussen
  5. # Christian Schulz
  6. #
  7. # Released under the GNU PUBLIC LICENSE
  8. #
  9. # Sample Makefile for a single executable with all sources in one directory.
  10. #
  11. # This Makefile finds all *.cpp source files in the current directory and
  12. # compiles them into corresponding *.o object files. Then all these object files
  13. # are linked to a single executable called main.
  14. #
  15. # The following targets are defined:
  16. #
  17. # - all Builds the application. Remember to run make depend first.
  18. #
  19. # - depend Scans through the source files to find the dependencies between
  20. # the source files.
  21. #
  22. # - clean Cleans the directory, removes object files and the executable.
  23. #
  24. # - distclean Cleans the directory extensively. Use this before submitting a
  25. # compulsory exercise.
  26. #
  27. #
  28. # Some useful CXXFLAGS:
  29. #
  30. # -I<dir> Also look in <dir> for header files
  31. # -g2 produce debugging information
  32. # -Wall turn on important warnings
  33. # -Werror treat warnings as errors
  34. # -O3 optimize for speed
  35. # -ffast-math avoids some checks in math-routines
  36. # -fsingle-precision-constant use float constants (instead of double)
  37. # -pedantic make gcc picky
  38. # -fprofile-arcs Does profiling in order to optimize branching
  39. # -fbranch-probabilities Uses the result of profile-arcs to do the actual
  40. # branch prediction
  41. #
  42. # Some useful LDFLAGS
  43. #
  44. # -l<lib> Link with library
  45. # -L<dir> Also look in <dir> for libraries
  46.  
  47. APP := main
  48. CXX := g++
  49. LD := g++
  50. SOURCES := $(wildcard *.cpp)
  51. OBJECTS := $(patsubst %.cpp, %.o, $(SOURCES))
  52.  
  53. CXXFLAGS := $(CXXFLAGS) -Wall -pedantic -g2 -DDEBUG
  54. LDFLAGS := $(LDFLAGS) -lm -lGL -L/usr/X11R6/lib -lGLU -lglut -lGLEW -lXi -lXmu
  55.  
  56. .PHONY: all depend clean
  57.  
  58. all: depend $(APP)
  59.  
  60. $(APP): $(OBJECTS)
  61. $(LD) -o $(APP) $(LDFLAGS) $(OBJECTS)
  62.  
  63. depend: make.dep
  64.  
  65. make.dep:
  66. # touch $@
  67. # makedepend -f$@ -- $(CXXFLAGS) -- $(SOURCES)
  68. for file in $(SOURCES); do $(CXX) $(CXXFLAGS) -M $$file >> $@; done
  69.  
  70. include make.dep
  71.  
  72. clean:
  73. rm -f *.o *.a *~ core $(APP)
  74.  
  75. distclean: clean
  76. rm -f make.dep *.bak
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement