0

I work on a project which is often built and run on several operating systems and in multiple configurations. I use two compilers: icc and gcc, and multiple sets of arguments for those compilers. That can give me many variants of build of one project.

What I would like to do is:

  • compile project using icc or gcc compiler with one set of arguments
  • test the performance of the application befor and after new build>
  • compare obtained results
  • compile project for another set of arguments and repeat previous steps

Has anyone an idea how to do it nicely using makefile?

  • You must elaborate on steps 2 and 3. By "performance" do you mean speed, memory use, something else? How do you want to "compare" the results-- just verify that they are identical, or similar in some sense? A good test harness can be very simple or very complex, depending on what you're testing. – Beta Sep 05 '12 at 18:24

1 Answers1

0

You just need to cascade your make-targets according to your needs: E.g.:

# Assumed that $(CONFIGURATION_FILES) is a list of files, all named *.cfg
# There you store your set of arguments per step

#The main target 
all: $(CONFIGURATION_FILES)

#Procedure for each configuration-file
%.cfg: compile_icc compile_gcc test compare

compile_icc:
#DO whatever is necesarry

compile_gcc:
#DO whatever is necesarry

test:
#DO whatever is necesarry

compare:
#DO whatever is necesarry

However, for this kind of job I would rather use some build-automation tool ... I only know Maven, but for Makefile-Based build some other tools may fit better ... take a look on the different options e.g. here: https://en.wikipedia.org/wiki/List_of_build_automation_software

Alex
  • 1,602
  • 20
  • 33