Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic makefiles for Linux C code #6

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

teodutu
Copy link
Member

@teodutu teodutu commented Mar 29, 2022

Add generic Linux makefiles with default compilation recipes and flags. They cover the following use cases:

  • creating a single executable using multiple files (single.mk);
  • creating multiple executables, each based on a single source code file (multiple.mk).

For other use cases, use linux.mk and create a custom makefile.

The makefiles are based on those used in the "Hardware-Software Interface" course, which were added here: systems-cs-pub-ro/iocla#89.

@teodutu teodutu self-assigned this Mar 29, 2022
@teodutu teodutu added the enhancement New feature or request label Mar 29, 2022
@teodutu teodutu mentioned this pull request Mar 29, 2022
6 tasks
@razvand
Copy link
Contributor

razvand commented Apr 27, 2022

@teodutu , please add that lengthier description from the PR in the commit message.

content/common/multiple.mk Outdated Show resolved Hide resolved
content/common/linux.mk Outdated Show resolved Hide resolved
content/common/linux.mk Outdated Show resolved Hide resolved
content/common/multiple.mk Outdated Show resolved Hide resolved
content/common/multiple.mk Outdated Show resolved Hide resolved
content/common/single.mk Outdated Show resolved Hide resolved
content/common/single.mk Outdated Show resolved Hide resolved
content/common/single.mk Outdated Show resolved Hide resolved
content/common/multiple.mk Outdated Show resolved Hide resolved
@teodutu teodutu force-pushed the generic-makefiles branch 2 times, most recently from efbae71 to ad0aec5 Compare May 2, 2022 13:33
@teodutu teodutu requested a review from razvand May 2, 2022 13:33
@teodutu teodutu force-pushed the generic-makefiles branch 2 times, most recently from da13d8b to 96487d2 Compare May 21, 2022 13:50
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments on using variables. And likely using defs.mk for very simple definitions.

content/common/linux.mk Outdated Show resolved Hide resolved
content/common/linux.mk Outdated Show resolved Hide resolved
content/common/linux.mk Outdated Show resolved Hide resolved
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments. Then this can be approved and merged.

content/common/utils/utils.h Show resolved Hide resolved
content/common/utils/utils.h Outdated Show resolved Hide resolved
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments. Please also include a debug.h header file.

content/common/makefile/linux.mk Show resolved Hide resolved
content/common/makefile/defs.mk Outdated Show resolved Hide resolved
content/common/utils/utils.h Show resolved Hide resolved
content/common/makefile/linux.mk Outdated Show resolved Hide resolved
@teodutu teodutu requested a review from razvand September 6, 2022 08:58
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would give up debug.h all together. And simply import this logging library.

It's simple, easy to use has a lot of stars, and we can improve it for our work (there are a lot of PRs that we can take inspiration from). It's MIT Licensed, compatible with BSD-3-Clause.

We would simply add the two files (log.c and log.h) in the common/folder/. We would include log.h and link against link.c.

content/common/utils/debug.h Outdated Show resolved Hide resolved
content/common/utils/utils.h Outdated Show resolved Hide resolved
content/common/utils/utils.h Outdated Show resolved Hide resolved
content/common/utils/utils.h Outdated Show resolved Hide resolved
@teodutu
Copy link
Member Author

teodutu commented Sep 13, 2022

I would give up debug.h all together. And simply import this logging library.

Aggreed. How do you say we should cite / give credit to this library?

@razvand
Copy link
Contributor

razvand commented Sep 13, 2022

Agreed. How do you say we should cite / give credit to this library?

I think you would just add it to the repository and add a comment line in both files to mention the licensing and reference the GitHub link.

@teodutu teodutu force-pushed the generic-makefiles branch 2 times, most recently from e1c49e8 to ee7ad0b Compare September 14, 2022 18:37
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@teodutu , I added a test inside the common/ folder and made minor updates to log/ and utils.h. See the commits and see if it's OK with you.

I've also made two minor inline comments.

content/common/makefile/linux.mk Outdated Show resolved Hide resolved
content/common/test/Makefile Show resolved Hide resolved
content/common/utils/utils.h Outdated Show resolved Hide resolved
Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All OK with me. Merge it, @teodutu .

They cover the following use cases:

- creating a single executable using multiple files (`single.mk`);
- creating multiple executables, each based on a single source code file
(`multiple.mk`).
- logging and error messages via `utils/utils.h` and `utils/log/log.c`

For other use cases, use `linux.mk` and create a custom makefile.

The makefiles are based on those used in the
"Hardware-Software Interface" course, which were added here:
systems-cs-pub-ro/iocla#89.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
@teodutu teodutu merged commit 53eac6a into open-education-hub:master Sep 27, 2022
@teodutu teodutu deleted the generic-makefiles branch November 12, 2022 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants