Compile specific files without optimization
Compile specific files without optimization
I want to compile ROMS with -O3 optimization, while compiling one particular source file without O3. Does anyone know how to modify the build script or makefile to support this?
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile specific files without optimization
In the platform-specific make files in subdirectory Compilers, there are examples of the compiler flags being altered for specific targets, eg, this from Compilers/Linux-ifort.mk
Here the FFLAGS variable is having an extra option appended to it, but the same variable could also be overwritten or modified by any of Gnu make's string-processing functions.
Also note that the above modifications only apply when the specified target is being built, and the scheme can be defeated if you build things in a non-standard order.
Code: Select all
#
# Set free form format in source files to allow long string for
# local directory and compilation flags inside the code.
#
$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -free
$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -free
...
Also note that the above modifications only apply when the specified target is being built, and the scheme can be defeated if you build things in a non-standard order.