This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using make to copy a set of files when directory is referenced.

While I using Eclipse, rarely I needed to use the MAKE or when I needed the knowledge he had was enough.

Now I need to do some actions, such as copying files from one directory to another whenever the presence of one or another variable and when the directory is referenced by another rule, clearing the destination before removing the files if another architecture.

Having the presence of a particular variable, such as `__AVR_ATmega328P`, `__AVR_ATmega2560` or `__ARM_xxxx` he must copy some files from `/users/extra/lib/atmega328P` or `/usr/extra/lib/atmega2560`, `/usr/extra/lib/arm/cmsis` respectively, to the `/usrs/extra/workspace/projetoZeta/lib` whenever it is referenced.

It is important to note that the `Rule` that will make this task, is a secondary customization file, as in the master file I have no way to change.

Besides that need it the secondary `Rule`, which makes copies, is automatically called by other `Rule`, without the need to interfere in each primary, where the `/users/extra/workspace/projetoZeta/lib` directory  is referenced, this should be checked and if necessary the copied files.

In the end, do not know how someone could provide me some example? I got to read the manual and even the https://www.gnu.org/software/make/manual/html_node/Echoing.html Echo I have getting use to help me debug what I'm doing at MAKE.

Parents
  • Hello jensbauer!

    I think the "Make" will not meet my expectation, I think what I need is not posível, not yet. I do not think the output is to use a script as the shell to copy files. Well, anyway I see how I will still have to devote to studies of Make.

    Well, I have seen this week, by indication of the Livius, the new CMSIS-Pack concept, which seems to be well connected with what I want, I'll see how I can use it and if I can extend it for mining needs without hurting license use.

    The advantage of ASF package from Atmel is that it has everything it takes to work with Atmel, AVR or ARM is, and comes CMSIS also, but Atmel has not yet adopted the new CMSIS 4 that defines this packaging approach. And the ASF package is organized so that seems laborious separation of files, maybe I'll make a redistribution of files and place in my repository so it can be downloaded when needed.

    Concerning the use of the links, which is undoubtedly the best choice, I always used when programmed in Java, helped me a lot to manage hundreds of packages / framworks of projects without having to keep thousands of copies of jar files on it, but it seems that the GCC plugin or Eclipse CDT does not get along well with links, I have not done deep testing, but already noticed problems when trying to create references for use with my projects. Tutorial in GNU ARM Eclipse Plugin also cites such problem.

Reply
  • Hello jensbauer!

    I think the "Make" will not meet my expectation, I think what I need is not posível, not yet. I do not think the output is to use a script as the shell to copy files. Well, anyway I see how I will still have to devote to studies of Make.

    Well, I have seen this week, by indication of the Livius, the new CMSIS-Pack concept, which seems to be well connected with what I want, I'll see how I can use it and if I can extend it for mining needs without hurting license use.

    The advantage of ASF package from Atmel is that it has everything it takes to work with Atmel, AVR or ARM is, and comes CMSIS also, but Atmel has not yet adopted the new CMSIS 4 that defines this packaging approach. And the ASF package is organized so that seems laborious separation of files, maybe I'll make a redistribution of files and place in my repository so it can be downloaded when needed.

    Concerning the use of the links, which is undoubtedly the best choice, I always used when programmed in Java, helped me a lot to manage hundreds of packages / framworks of projects without having to keep thousands of copies of jar files on it, but it seems that the GCC plugin or Eclipse CDT does not get along well with links, I have not done deep testing, but already noticed problems when trying to create references for use with my projects. Tutorial in GNU ARM Eclipse Plugin also cites such problem.

Children
  • Currently I'm using one single library folder, where I have all my LPC libraries (plus one from Freescale and one from ST).

    I've generalized my Makefile, so that it allows me to specify a library path, which points to the particular library.

    In addition, I've created an output folder (see Freddie Chopin's Makefile for LPC43xx as a reference on how this can be done).

    The reason the output-folder is required, is that whenever you build your project, the .o files are usually placed right next to your sources.

    If that is the case, and you have two different projects, one that uses Ethernet and one that does not use Ethernet, then you may have to use "make clean" whenever you've just build the other project, in order to get the files up to date. An output folder that belongs to your project would be a good solution to this problem, plus it would speed up building as you can suddenly use dependencies.

    I've never had problems with symlinks and GCC. If you have problems with your setup, it may be happening if you're running on Windows, but it would more likely be a problem with Eclipse.

    I use symlinks when I build my GCC toolchain, so I'm very confident that GCC can handle it. If you're already on Linux, then I would blame Eclipse.

    -The Makefile is capable of doing the copying, but it might be a bit complicated. As you write, it might be an easier solution to use a script for this task.

    -If you end up copying files, you may want to take a look at 'man cp'; it'll tell you about the '-R' option for recursively copying the files. I don't think you will need any other switches, but I'll mention the '-n' switch is so that files will not be overwritten, and the '-f' switch is in order to force copying (overwrite target files).

  • > I've never had problems with symlinks and GCC

    unfortunately you cannot create portable project using symlinks, since they are not available on Windows, so I generally do not recommend this solution.

    Eclipse references to folders and files can be defined in a portable way, using macros with the project/workspace base address; I'm pretty convinced they can be used for the purpose you mentioned, but they just require some attention.

    Carlos, can you point me the tutorial page where Eclipse links are not recommended, to check the content for correctness?

    Liviu

  • I did some tests here and I did not success, just do not find the files. it gave no error besides not find the files.

    Of course I am a beginner, and I must be doing something wrong, which I am researching.

    The link I saw on synlinks fault with is the following: http://playground.arduino.cc/Code/Eclipse

  • I don't use Windows, only MAC OS and Linux.

  • On windows with ntfs has #symlinks, but it is not good, always generates exceptions in the OS, and even screen azull (hehehe), but it exists.

    There is a tool to assist the use of symlinks in all versions of windows: http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux /

    Well, anyway, my environment is *nix, and will not give up. : D