Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
pe cialS   lea seRe      Code Smart, Don’t Code Hard
?
GCC
....$ gcc -o hw1 hw1.c
....$ gcc -o hw2 main.c a.c b.c
$   gcc   -c   main.c #     main.o$   gcc   -c   a.c #    a.o$   gcc   -c   b.c #    b.o$   gcc   -o   hw2 main.o a.o b.o
....?g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs...
Make?
Makefile# #targets: prerequisites    recipe    ...   }
Makefile#hw1: hw1.c    gcc -o hw1 hw1.c    echo “       ”
#                 (       )main.o: main.c    gcc -c main.ca.o: a.c    gcc -c a.cb.o: b.c    gcc -c b.chw1: main.o a.o b.o ...
CC = gccmain.o: main.c    $(CC) -c main.ca.o: a.c    $(CC) -c a.cb.o: b.c    $(CC) -c b.chw1: main.o a.o b.o    $(CC) -o h...
-CC = gcc    pattern rule                            prerequisite%.o: %.c    $(CC) -c $<hw1: main.o a.o b.o    $(CC) -o $@...
CC = gccCFLAGS = -Wall -O2OBJS = main.o a.o b.oEXEC = hw1%.o: %.c    $(CC) $(CFLAGS) -c $<$(EXEC): $(OBJS)    $(CC) $(CFLA...
....$   makeg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/...
(CrBoy) <crboy@crboy.net>CC   -             3.0                ID E-mail
Code Smart - Makefile (special release)
Code Smart - Makefile (special release)
Upcoming SlideShare
Loading in …5
×

Code Smart - Makefile (special release)

2,363 views

Published on

This slides is licensed under CC-BY-SA 3.0 Taiwan. It is welcome to share and remix, as long as you credit the author(s) and license the new creations under the identical terms.

Published in: Business, Technology, Art & Photos
  • Be the first to comment

Code Smart - Makefile (special release)

  1. 1. pe cialS lea seRe Code Smart, Don’t Code Hard
  2. 2. ?
  3. 3. GCC
  4. 4. ....$ gcc -o hw1 hw1.c
  5. 5. ....$ gcc -o hw2 main.c a.c b.c
  6. 6. $ gcc -c main.c # main.o$ gcc -c a.c # a.o$ gcc -c b.c # b.o$ gcc -o hw2 main.o a.o b.o
  7. 7. ....?g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o glwidget.o glwidget.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o main.o main.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o window.o window.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o qtlogo.o qtlogo.cpp/usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I.glwidget.h -o moc_glwidget.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_glwidget.o moc_glwidget.cpp/usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I.window.h -o moc_window.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_window.o moc_window.cppg++ -o hellogl glwidget.o main.o window.o qtlogo.o moc_glwidget.o moc_window.o -L/usr/lib -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread
  8. 8. Make?
  9. 9. Makefile# #targets: prerequisites recipe ... }
  10. 10. Makefile#hw1: hw1.c gcc -o hw1 hw1.c echo “ ”
  11. 11. # ( )main.o: main.c gcc -c main.ca.o: a.c gcc -c a.cb.o: b.c gcc -c b.chw1: main.o a.o b.o gcc -o hw1 main.o a.o b.o
  12. 12. CC = gccmain.o: main.c $(CC) -c main.ca.o: a.c $(CC) -c a.cb.o: b.c $(CC) -c b.chw1: main.o a.o b.o $(CC) -o hw1 main.o a.o b.o
  13. 13. -CC = gcc pattern rule prerequisite%.o: %.c $(CC) -c $<hw1: main.o a.o b.o $(CC) -o $@ main.o a.o b.o target
  14. 14. CC = gccCFLAGS = -Wall -O2OBJS = main.o a.o b.oEXEC = hw1%.o: %.c $(CC) $(CFLAGS) -c $<$(EXEC): $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS)
  15. 15. ....$ makeg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o glwidget.o glwidget.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o main.o main.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o window.o window.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o qtlogo.o qtlogo.cpp/usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. glwidget.h -o moc_glwidget.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_glwidget.o moc_glwidget.cpp/usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. window.h -o moc_window.cppg++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_window.o moc_window.cpp......g++ -o hellogl glwidget.o main.o window.o qtlogo.o moc_glwidget.o moc_window.o -L/usr/lib -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread$ _
  16. 16. (CrBoy) <crboy@crboy.net>CC - 3.0 ID E-mail

×