Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
master-embedded-systems
c-exercise-solutions public
Commits
0052e05c
Commit
0052e05c
authored
Oct 24, 2017
by
Stefan Tauner
Browse files
makefile: allow compiler to be set and use gcc only as default
parent
b773f28e
Changes
1
Hide whitespace changes
Inline
Side-by-side
makefile
View file @
0052e05c
...
...
@@ -38,7 +38,9 @@ ifeq ($(filter $(MAKECMDGOALS),clean help),)
endif
endif
### Recommended gcc flags
CC
?=
gcc
### Recommended compiler flags
CFLAGS
=
-std
=
gnu99
CFLAGS
+=
-Os
CFLAGS
+=
-pedantic
...
...
@@ -60,10 +62,10 @@ CFLAGS += -Wunreachable-code
### all ###
all
:
$(OBJS) $(CURDIR)/$(TARGET).elf
$(CURDIR)/$(TARGET).elf
:
$(OBJS) | $(BUILDDIR)
gcc
$(CFLAGS)
$(INCS)
-o
$(CURDIR)
/
$(TARGET)
.elf
$(OBJS)
$(CC)
$(CFLAGS)
$(INCS)
-o
$(CURDIR)
/
$(TARGET)
.elf
$(OBJS)
$(BUILDDIR)/%.o
:
$(SRCDIR)/%.c | $(BUILDDIR)
gcc
-c
$(CFLAGS)
$(INCS)
$<
-o
$@
$(CC)
-c
$(CFLAGS)
$(INCS)
$<
-o
$@
$(BUILDDIR)
:
mkdir
-p
$(BUILDDIR)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment