Skip to content

Create my own advanced Makefile#342

Open
ericsandu wants to merge 5 commits intorosedu:cdl-08from
ericsandu:gnumake-custom
Open

Create my own advanced Makefile#342
ericsandu wants to merge 5 commits intorosedu:cdl-08from
ericsandu:gnumake-custom

Conversation

@ericsandu
Copy link
Copy Markdown

Add Makefile for compiling greetings.c and twoparter built from part1.c, part2.c and header.h

The makefile uses the wildcard function, variables for file states and compiler flags and multiple declaration formats for build rules

All operations and their behaviours are explained in comments inside the file

Signed-off-by: ericsandu <eric_andrei.sandu@stud.acs.upb.ro>
Copilot AI review requested due to automatic review settings March 22, 2026 13:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a custom GNU Make Makefile intended to build two small C executables (greeting and twoparter) and provide a clean target, as part of the repository’s gnumake/ examples.

Changes:

  • Introduces gnumake/custom/Makefile with all, greeting, twoparter, and clean targets.
  • Adds variables for compiler selection and flags, and attempts to use wildcard to detect built executables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gnumake/custom/Makefile
Comment on lines +23 to +27
ifdef GREETING_EXISTS
rm greeting
endif
ifdef TWOPARTER_EXISTS
rm twoparter
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

ifdef GREETING_EXISTS / ifdef TWOPARTER_EXISTS will always evaluate true here because both variables are assigned unconditionally (and are non-empty). This makes clean try to remove files even when they don’t exist, and rm will fail the target. Prefer rm -f greeting twoparter, or use ifneq ($(wildcard greeting),) style checks instead of ifdef.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed by assigning NULL value instead of 0 in variables

Comment thread gnumake/custom/Makefile Outdated
Comment thread gnumake/custom/Makefile Outdated
Comment thread gnumake/custom/Makefile Outdated
Comment on lines +15 to +16
greeting: greeting.c

Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

PR description mentions compiling greetings.c, but the Makefile (and the directory contents) refer to greeting.c. Please align the PR description with the actual filename (or rename the target/source if the intention was greetings.c).

Copilot uses AI. Check for mistakes.
Comment thread gnumake/custom/Makefile Outdated
ericsandu and others added 4 commits March 22, 2026 15:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: ericsandu <eric_andrei.sandu@stud.acs.upb.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants