Generate MAKFILE dependency with header and source files in separate directory - makefile

I have 3 layer architecture project for embedded
top layer - application
middle layer - middle(HAL Layer)
bottom layer - bottom(Driver layer)
I need to make a Makefile for the project with multiple source and header files which are in different directories.
For sake of understanding of makefile consider this as c project.
The issue I am facing is I am not able to generate the dependency files for the source files.
I have seen many tutorials but mostly in the example code of MAKEFILE, the header files are present in the same folder with the source files.
In my case the files are in the below structure.
project
|
|---- _build(DIR)
| --- Makefile
|
|---- application(DIR)
| inc/main.h
| src/main.c
|
|---- middle(DIR)
| inc/middle.h
| src/middle.c
|
|---- bottom(DIR)
| inc/bottom.h
| src/bottom.c
As the header files are in separate folder, I am not able to generate the dependency files(.d files).
Without including header files like
-I<header_files>
How to generate the dependency files?
http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
No Header file is included using -I options because source and header files are in same folder
Youtube example but same result, header and source in same folders.
https://www.youtube.com/watch?v=NPdagdEOBnI

Related

Laravel nWidart/laravel-modules, move an existing module to another folder

I have a bunch of modules in Modules folder. For example "Modules/Customers"
And I need to move everything to "Modules/Core/Customers" keeping all the functionality working. Besides I must will use another subfolder for some modules:
Modules
|___ Core
| |__ Customers
| |__ Products
|
|___ External
|__ Taller
I suppose there might be three possibilities:
1- Lucky one: automatically with an artisan command, but I did not find anything on documentation (https://docs.laravelmodules.com/)
2- Manually changing files and configs, but I suppose that will leave namespaces unchanged, and that is not acceptable I would say.
3- Worst but likely: manually changing namespaces and config files.
I went for the third one as #lk77 suggested and everything was correct if I changed the folder for modules in config file module.php, except that then I cannot add several paths (or I don not find the way as it does not seem to be an array) or a more generic Modules/* as path.
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Modules/Core'),
Thanks a lot!!
Thanks very much
Here is what I finally did. For the existing modules created previously in "Modules":
1- Move files to Modules/Core folder and change manually all references to "Modules/" for "Modules/Core" in folders "app", "bootstrap" and "Modules" (with help of replace all from sublime :-) ). Afterwards it was necessary to manually change references in files "composer.json" and "module.json" of each module.
2- In config/modules.php activate scan:
'scan' => [
'enabled' => true,
'paths' => [
base_path('Modules/Core'),
base_path('Modules/External'),
base_path('vendor/*/*'),
],
],
After doing this old modules seemed to be working properly, but trying to include new ones triggered errors.
In fact the versions that included the feature to add the possibility for managing submodules/subfolders were retired shortly after the release.
So, finally I guess it is better not to use this approach with the package due to the problems.
In the end we are going to use subfolders in Laravel default tree for the core modules and use the package laravel-modules for external and optional custom modules:
app
|
|--- Http
| |
| |--- Controllers
| . |
| . |--- Customers
| |--- Products
|
|--- Models
. |
. |--- Customers
. |--- Products
.
.
Modules
|--- Taller
.
.
.

Creating a CMakeLists.txt with header and mains

I have divided my program in 3 folders: build, include, and src.
Build is where I want all the files created from the Makefile to go, include contains a "file.h", and src contains a "file.c" and "main.c".
I have written this in the CMakeLists.txt file:
cmake_minimum_required (VERSION 3.5.1)
project(Listas_interlazadas)
include_directories(${include})
add_executable(ejec
src/main.c
src/listas.c
include/listas.h
)
Nonetheless, I believe I should somehow include the src folder. Also, how do I send all files to the build folder? From the terminal, right?
Thanks.
Your code need some minor reworks.
The command include_directories must point to an valid path
Add header files only in case they are not included in any of your source files
Assume the following structure of your project:
project
+--source
| +--CMakeLists.txt
| +--src
| | +--main.c
| | +--listas.c
| +--include
| +--listas.h
+--build
Reworked CMakeLists.txt
cmake_minimum_required (VERSION 3.5.1)
project(Listas_interlazadas)
include_directories(include)
add_executable(ejec
src/main.c
src/listas.c
)
Back to your questions:
Add the sources: You already inserted the required source files. See add_executable.
Copy sources to build folder: This is not necessary.
To build your project, you have to run cmake and make (or nmake on windows).
Steps:
Open a command shell
Move to the build folder
Run: cmake ../source
Run: make
Some important parts of a CMakeLists.txt

Mindscape Web Workbench generates duplicate CSS files when compiling with Sass

I have set up Mindscape Web Workbench with my Visual Studio 2010 project so that the compiled SCSS files are outputted to a separate folder. My intended structure is something like this:
Styles/
|
|– output/
| |– toMain.css
| |– toMain.css.map
|
| – toMain.scss
But what I'm getting is 2 outputs, like so:
Styles/
|
|– output/
| |– toMain.css
| |– toMain.css.map
|
| – toMain.scss
| |– toMain.css
| |– toMain.css.map
I've double checked the output settings for the toMain.scss file via Mindscape > Web Workbench Settings and the only output I see is indeed that file set for the Styles/output folder, but I'm still getting the duplicate. I don't have any other extension in VS2010 that handle SASS, and I can't seem to find any information about this issue anywhere. Are there any other settings for the extension that could be causing this?
EDIT: It may be worth noting that I'm using Team Foundation Server with this project - so the outputted CSS is excluded from source control. I'm not sure if this makes a difference.
i had that too before.
File with .map extension is use to decode your compressed file, for example you have .js file that you minimize to .min.js, to help decompress your file you can use .map.
So if you said that .map is shown at your generated folder, it means that you're css it compressed.
So you have 2 options :
1. do not compress your css file.
2. find the setting to not generate .map file.
im using prepros theres a setting for that.

How to use Sonar Runner on selected files?

I want to run Sonar Runner only on some selected files only. I'm using SonarRunner Ant.
My project directory structure is :
MyProject
|
|-----src
|-----java
|-----A
|-----B
| |---<files>.java
|
|-----C
| |---<files>.java
|
|-----hello.java
Now I want to run Sonar Runner only on hello.java file.
sonar.sources=../../../MyProject/src // takes the source directory
sonar.sources=../../../MyProject/src/java/A/hello.java didn't work
sonar.exclusions=**/**/*.java // excludes all java files
// now I want to include only hello.java file
// didn't find any parameter for inclusion, but tried the following
sonar.inclusions=hello.java // didn't work
sonar.inclusions=java/A/hello.java // didn't work
Referred this article for analysis parameters.
One solution which crossed my mind is : exclusion of all the files but the required ones.
But here the structure is just a small part. In real I have more than 250 java files, and want to generate report for, say, 10 files only. Then, by this approach, excluding 240+ files doesn't look a good idea.
Is there anyway to generate sonar report on selected files, other than the mentioned approach?
If you're looking for specific files, you might try the same syntax as is listed to explicitly exclude files (Narrowing the Focus - at the bottom)
#Absolute Path
To define an absolute path, start the pattern with "file:"
#Exclude all the *.cs files included in /path_to_my_project/myProject/src/generated and its subdirectories
sonar.exclusions=file:/path_to_my_project/myProject/src/generated/**/*.cs
#Exclude all the java classes contained in a src/generated/java directory and its subdirectories
sonar.exclusions=file:**/src/generated/java/**/*.java

Cmake: add_subproject & add_subfolder

I currently want to add some self written classes ("mycode.cpp" and "mycode.hpp") to a big existing C++ project that is configured with Cmake. These classes are located in "myfolder" which is located in the "lib/pointrender" folder of the existing project (see dummy hierarchy below).
|- libs
| |- core
| | |- ...
| |- pointrender
| |- myfolder
| | |- mycode.cpp
| | |- mycode.hpp
| |- existingclasses.cpp
| |- existingclasses.hpp
| |- project.cmake
|- CMakeLists.txt
In the CMakesLists.txt the pointrender folder is declared as a subproject.
declare_subproject(libs/pointrender)
How do I best add my code to the existing cmake configuration? Do I add it as a subfolder in the project.cmake with a seperate CMakeLists.txt in myfolder? Or do I best add it as a subproject with a seperate project.cmake file? What's the difference?
This project.cmake is being include()d be some CMakeLists.txt and get's executed as part of it. Authors of project you are using rolled this out for some reason, so it's probably better to use their infrastructure to add custom code.
The usual way to do this is writing your own CMakeLists.txt and add_subdirectory()ing it from the upper level.
If you wish more details you should update your question with project.cmake contents.

Resources