Compile specific files without optimization

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
jamak3
Posts: 2
Joined: Tue Sep 28, 2010 4:26 am
Location: California Polytechnic State University

Compile specific files without optimization

#1 Unread post by jamak3 »

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?

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Compile specific files without optimization

#2 Unread post by m.hadfield »

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

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
...
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.

Post Reply