c++ - Simple makefile with release and debug builds - Best practices -
I'm new to the makefile. I've read makefile creation and other related concepts from "Managing Project with GNU Making". Makefile is ready now and I need to make sure that what I have made is okay. MacFile
#memakefile that creates #MakedAfed Flags DFALGS = #comporal flag # if the mode variable is empty, set debug build mode ifeq ($ (mode), release) CFLAGS = -Wall Other modes = debug CFLAG = -G-valve endif CC = G ++ Prog = FUEEEEEEEEEEREROCRSC will attach to: = ManCap # Including details is included in the bar / module. MKM FU / Module .MK OB J: = $ (patsubst% .cpp,% .o, $ (filter% .ppp, $ (SRC))). Everything: info fooexe information: ifneq ($ (mode), release) ifneq ($ (mode), debug) @ AK "invalid build mode" @echo "please make 'mode' release 'or' create mode = debug ' "@ext 1 endiff asif @ ac" "$ (mode)" mode "@oo" building on .......... ................ "Program Fuxx # Linking: $ (obje) $ (cc) -o $ (progress) $ (obje)% .o:% CPP $ (cc) $ (CFLAGS) -C $ & lt; -O $ @ Dependent: MacDayferd - $ (DFALGS) - $ (SRC) .phone: Clearly: Find - Name "* .O" | Xargs rm -vf rm -vf fooexe Question - Works well with the Messedface releases and debug builds given above. But is it in the right format? Or are you looking at any blame in it?
- Use makefile debug on the default when create for release build, make mode = release is required. Is this the right approach?
- Is the debug and release compiler flags given for G ++ are correct? For debug, I use -g-wall and for release, just -Wall . Is it true?
Any help would be great.
- This is a proper format, it is specifically associated with GNU make, but This is a relatively small problem if you have chosen to use GNU Make on each platform.
- If there is a flaw, then it is that you can add the created object files in the debug mode to create the last build.
- Some people argue that the 'mode = release' option is non-standard; They will be right, but there is no standard option that I know. All you need to know is that your conference is not suitable for everyone (but there is no need to do this - it is just like you and your users).
- Debug build by default is probably sensible - and more intelligent than making a release build by default.
- Leaving the
-g flag for the release build is not bad at all, but if your code ever produces a core dump, the head or tail of the core dump is easy If the program file contains debugging information, the primary value of the debugging information is an additional section in the program file that does not need to be loaded in system memory - the cost of runtime is small - you should consider it Neither should it include optimization flags or not. With the GCC tool set, you can use both
-g and -O . Optimizing the code is difficult to debug, but it gives you (often important) performance advantages.
Comments
Post a Comment