Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

use make variables #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
udp-broadcast-relay-redux: main.c
gcc -g main.c -o udp-broadcast-relay-redux
$(CC) $(CFLAGS) -g main.c -o udp-broadcast-relay-redux
Copy link
Collaborator

Choose a reason for hiding this comment

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

For this change to not break if these vars are not defined, the Makefile needs the original defaults. Something along the lines of:

ifndef CC
override CC = gcc
endif

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review.

My understanding, and testing confirmed, that if CC was not defined, make used the default value cc, which on Linux for me at least links to gcc.

My testing without environment variables set gives basically the original command, but setting the environment variables to what I need allows me to cross compile.

Does this not work for you or others if the vars are not defined?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It might not always be set. Then the Makefile will fail in interesting ways. Always nice to have a default. This is defensive programming in action.


clean:
rm -f udp-broadcast-relay-redux