Skip to content

Commit

Permalink
Let environment set CC, add -W to CFLAGS, and prettify build output
Browse files Browse the repository at this point in the history
- Do not enforce gcc as CC, let environment decide (like optimization)
- Add -W to -Wall -Wextra, it does give slightly more warnings
- Slightly prettier build output

Signed-off-by: Joachim Nilsson <[email protected]>
  • Loading branch information
troglobit committed Jan 28, 2016
1 parent af29a68 commit 8bf105f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
.PHONY: all clean install dist

# Top directory for building complete system, fall back to this directory
ROOTDIR ?= $(shell pwd)

VERSION = 1.0-beta1
NAME = phytool
PKG = $(NAME)-$(VERSION)
ARCHIVE = $(PKG).tar.xz
APPLETS = mv6tool

PREFIX ?= /usr/local/
LIBS =
CC = gcc
CFLAGS = -g -Wall -Wextra
LDLIBS =
CFLAGS = -W -Wall -Wextra
CFLAGS += -g

objs = $(patsubst %.c, %.o, $(wildcard *.c))
hdrs = $(wildcard *.h)

%.o: %.c $(hdrs) Makefile
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
@$(CROSS_COMPILE)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@

phytool: $(objs)
@$(CROSS_COMPILE)$(CC) $(objs) -Wall $(LIBS) -o $@
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/$@)\n"
@$(CROSS_COMPILE)$(CC) $(LDLIBS) -o $@ $^

all: phytool

Expand Down

0 comments on commit 8bf105f

Please sign in to comment.