I have just used some script for NotePad++ NppExec.
Where can I find references to explain below terms from the excerpt of the script?
It is supposed to be in a single line, but I break it down to 4 lines to reduce horizontal scroll
Thank you.
-ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings
$(FILE_NAME) -o $(NAME_PART).exe & IF ERRORLEVEL 1
(echo. && echo Syntax errors were found during compiling.)
ELSE ($(NAME_PART).exe)
The text before the first & looks like command line options for a compiler. You could look at your compiler's documentation for the this part.
The remainder looks like Microsoft Windows batch commands. Use the help command at the command prompt for details.
Related
gcc4.9 supports the colorizing diagnostics for compiler warning/error messages.
We can enable it for a particular program using the option "fdiagnostics-color". Currently I am using gcc4.9.1 and I append this particular option in my makefile as follows:
CC = /home/mantosh/gcc-4.9.1/bin/g++ -std=c++1y -Wall -pthread
DFLAG = -g -gdwarf-2 -fdiagnostics-color=always
OUTFILE = test
$(OUTFILE): test.cpp
$(CC) $(DFLAG) -o $(OUTFILE) test.cpp
clean:
rm -f *.o $(OUTFILE)
If I compile a *.cpp file a get the following nice coloured message. This is really great feature added by GCC.
While reading the GCC offical link, it seems that this setting can permanently enabled using the GCC environmental variable "GCC_COLORS".
Could somebody explains how to set/change/customize this particular environment variable?
I am using Ubuntu12.04/GCC4.9.1.
just add this line to your ~/.bashrc file:
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
You can then reload it with source ~/.bashrc so you don't have to logout/login.
Is it possible to use both command line parameters to the configure script, ala:
../configure CXXFLAGS=-O0 -g -foo -bar -bat
while simultaneously keeping any options that are passed to AM_INIT_AUTOMAKE in the configure.ac file? e.g.:
AM_INIT_AUTOMAKE([-Wall -Werror])
My desired result is that ALL of the above flags are passed along, e.g.:
-O0 -g -foo -bar -bat -Wall -Werror
It appears that specifying CXXFLAGS on the command line either ingores or overwrites what is passed into AM_INIT_AUTOMAKE. If anyone knows of a way to do the union of the two sets, that would be extremely helpful. Thx!
The -W warning categories options have nothing to do with C[XX]FLAGS. These are command line arguments used when invoking automake.
Conversely, the AM_INIT_AUTOMAKE options like -Wall don't affect the compiler flags. It's just the decision to use these switch names that is resulting in the confusion. They have a similar meaning, e.g., -Werror will treat automake warnings as errors, but are totally unrelated.
In short, you have to pass -Wall, etc., in C[XX]FLAGS to influence the compiler. And add -Wall to AM_INIT_AUTOMAKE to enable all warning categories when automake is invoked.
I am trying to compile a program on ubuntu 12.04 64bit using make.While compiling i get an error
/bin/bash: -c: line 0: syntax error near unexpected token `(
This is after I changed the symlink of /bin/sh to /bin/bash instead of dash. (I did it because i had the same kind of error before and looking around the internet I found that the script may call bash functions which are not available in sh/dash.)
I also tried putting SHELL = /bin/bash at the top of my makefile but still no use...
Any help would be much appreciated.
edit
SHELL = /bin/bash
CC = gcc
CFLAGS= -std=gnu99 -L/ATLAS/lib/ubuntu12.04 -lflint -lgsl -lcblas -latlas -lm -lmpfr -lmpir -lrt -Wall -fopenmp
default: GPVSignature
GPVSignature: GPVSignature.o Keygeneration.o chol_parallel.o Sampling2.o sha1.o sha2.o timing.o
$(CC) $(CFLAGS) -o GPVSignature GPVSignature.o Keygeneration.o chol_parallel.o Sampling2.o sha1.o sha2.o timing.o
clean:
rm -f GPVSignature *.o
SSH_AGENT_PID=2065
GPG_AGENT_INFO=/tmp/keyring-alBJt6/gpg:0:1
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=ff0e3de12be325b4ae6276d100000009-1353535027.801191-1696704263
WINDOWID=56623110
GNOME_KEYRING_CONTROL=/tmp/keyring-alBJt6
NO_PROXY=localhost,127.0.0.0/8
USER=salman
http_proxy=http:(---)
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40; 33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/tmp/keyring-alBJt6/ssh
SESSION_MANAGER=local/ubuntu:#/tmp/.ICE-unix/2026,unix/ubuntu:/tmp/.ICE-unix/2026
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin: /bin:/usr/games
DESKTOP_SESSION=ubuntu
PWD=/home/salman/
GNOME_KEYRING_PID=2015
LANG=en_US.UTF-8
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
UBUNTU_MENUPROXY=libappmenu.so
COMPIZ_CONFIG_PROFILE=ubuntu
GDMSESSION=ubuntu
HOME=/home/salman
SHLVL=1
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
no_proxy=localhost,127.0.0.0/8
LOGNAME=salman
BUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-RUfHXImIYm,guid=c49ca476a7f4b008964105c90000004e
LESSOPEN=| /usr/bin/lesspipe %s
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
LESSCLOSE=/usr/bin/lesspipe %s %s
COLORTERM=gnome-terminal
XAUTHORITY=/home/salman/.Xauthority
_=/usr/bin/env
OLDPWD=/home/salman/Desktop
How about this?:
SHELL:=/bin/bash
CC:=gcc
CFLAGS:=-std=gnu99 -L/ATLAS/lib/ubuntu12.04 -lflint -lgsl -lcblas -latlas -lm -lmpfr -lmpir -lrt -Wall -fopenmp
default: GPVSignature
GPVSignature: GPVSignature.c Keygeneration.c chol_parallel.c Sampling2.c sha1.c sha2.c timing.c
clean:
rm -f GPVSignature *.o
The indentation under the clean: line (before the rm) is a TAB character! This is important. My guess is that you don't have the indentation correct on the recipe lines (under GPVSignature: and under clean:). Also, you don't need to give an explicit recipe, because GNU make comes with a number of recipes of its own.
Note: I am assuming the file extensions are .c here, because it is customary and you use gcc, not g++. If that's not the case you need to introduce a pattern rule to tell GNU make how to create .o files from whatever extension you are using for your source files.
Even assuming your original recipe, I'd suggest the following more succinct line:
$(CC) $(CFLAGS) -o $# $^
... also indented by a single tab character (unless you tell GNU make to use a different character, which you obviously don't).
Two more things.
Is the Makefile/GNUmakefile a simple ASCII text file or a UTF-8 file with BOM? Execute file Makefile and post the output, please.
Check the following screenshots. This (second screenshot) is how it should look correctly indented with tabs in Vim (assuming you have the syntax file installed) ... specifically note the colors of the recipe for GPVSignature. The first screenshot is wrong, the second is
Other than that I am out of ideas. And there would have to be something you aren't mentioning.
In Arch Linux PKGBUILD for surf browser, there is:
sed -i 's/CPPFLAGS =/CPPFLAGS +=/g' config.mk
sed -i 's/CFLAGS =/CFLAGS +=/g' config.mk
sed -i 's/LDFLAGS =/LDFLAGS +=/g' config.mk
Why must the flags be changed from
CPPFLAGS = -DVERSION=\"${VERSION}\"
to
CPPFLAGS += -DVERSION=\"${VERSION}\"
I've looked into google, but don't see anything there about this. Can someone please explain and tell me where to read more about these flags?
I did quite a lot of googling and found that this pattern (Surf's is here) seems fairly common in Arch Linux PKGBUILD files. Another example was in DWM's PKGBUILD.
Obviously it is patching the config.mk file so that when make is called, the values are appended to the flags instead of overriding the flags (which must already be set elsewhere). So there must be existing settings that need to be retained. This seems to just be done by default by the package builders so it was hard to find the reason.
Looking further I found this bug report relating to DWM's config.mk file, where the author notes that a version of that file was overriding flags set in makepkg.conf which is the main configuration file for makepkg, which allows tuning compilation settings per machine. This seems like a reasonable explanation for what you found. From that page, a default value for CFLAGS would be something like this:
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
So the patched config.mk file would result in the following when building the package:
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -std=c99 -pedantic -Wall -Os -I. ....."
My configure.ac contains
AC_PROG_CXX
and my Makefile.am contains
AM_CXXFLAGS= -Werror -O3
and the resulting 'configure' script keeps on adding -O2 to the mix in addition to O3.
I have this suspicion that I'm supposed to do something in configure.ac to declare my preference for O3, but I can't find it in the doc. How do I tell it that I want to control the optimization level?
No, you are not supposed to add anything to configure.ac to indicate a preference for -O3. That sort of thing belongs in a user's CONFIG_SITE, not in configure.ac
However, if you insist on breaking the convention, you can do something like:
: ${CXXFLAGS=-Werror -O3}
Note that this line must appear before AC_PROG_CXX (or any macro that AC_REQUIRES it, such as LT_INIT, as that will cause AC_PROG_CXX to be emitted into the configure script before this line.)
The prior answer is correct in that it should be the installer's choice what flags are used. If you're still wondering where the -g -O2 comes from (likely), it is described at http://www.gnu.org/s/hello/manual/autoconf/C_002b_002b-Compiler.html.
That page does suggest "If your package does not like this default, then it is acceptable to insert the line ‘: ${CXXFLAGS=""}’ after AC_INIT and before AC_PROG_CXX to select an empty default instead."