Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

touch file

I have a file that includes the standard __DATE__ and __TIME__ macros and other information, and prints it to the console. I use this as a quick way of checking the build version of my software. I need to force the file to be recompiled every build, since the code itself never changes and it is easy to forget to open and save the file during a busy debug session. The shell command "touch <file>" wouild do this if made part of the makefile.

Is there a convenient point - script file - in the IDE tool chain where I could insert this command? Or is there a way to include a user script at the start of every build? I want to keep using the IDE and so need to limit the rework whenever it is upgraded.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There&#39;s lots of ways to do this. One possible way is to create a seperate makefile (e.g. touch.mk) which contains something like the following:

    all: touch_myfile
    touch_myfile:
           touch my_file.c
    .PHONEY: touch_myfile

    Then from the Windows control panel create the environment variable MAKEFILES which has as it&#39;s value the path to the makefile you just created, e.g. C:/touch.mk.

    Alternatively you could just add the above content to app.mk in the Nios II kit.

    I haven&#39;t tested the above, but something like it should work.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Perfect! Thank you for the solution, it works really well. I used MAKEFILES to avoid modifying any NIOS files. This is the script that works for me:

    all: touch_myfile
    touch_myfile:
       touch -c ../mybuildinfo.c
       echo "Touch script running in: " `pwd`
    .PHONEY: touch_myfile

    [-c flag to prevent dumping spurious empty .c files as the make traverses directories; ../ as the make executes in the Release or Debug directory below the source file.] http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif