Skip to content

Commit

Permalink
Beautify build output
Browse files Browse the repository at this point in the history
This changes the build output to match the Linux kernel's style:
$ make
  CC  dpcmd.o
  CC  usbdriver.o
  CC  FlashCommand.o
  CC  SerialFlash.o
  CC  parse.o
  CC  board.o
  CC  project.o
  CC  IntelHexFile.o
  CC  MotorolaFile.o
  LD  dpcmd
All done.

To see the compiler calls, specify make V=1

Signed-off-by: Stefan Reinauer <[email protected]>
  • Loading branch information
reinauer committed Nov 21, 2020
1 parent ea8131f commit ec86ad4
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
#
#

# Make is silent per default, but 'make V=1' will show all compiler calls.
Q:=@
ifneq ($(V),1)
ifneq ($(Q),)
.SILENT:
endif
endif

PROGRAM = dpcmd
CC = gcc
PREFIX ?= /usr/local
Expand All @@ -23,11 +31,16 @@ SRCS = dpcmd.c usbdriver.c FlashCommand.c SerialFlash.c parse.c board.c project.

PROGRAMMER_OBJS := $(SRCS:%.c=%.o)

all: $(PROGRAM)
printf "All done.\n"

$(PROGRAM): $(PROGRAMMER_OBJS)
printf " LD $@\n"
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS)

%.o : %.c
%.o : %.c $(DEPDIR)/%.d | $(DEPDIR)
printf " CC $@\n"
$(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

$(DEPDIR): ; @mkdir -p $@
Expand All @@ -42,14 +55,14 @@ clean:
rm -rvf $(DEPDIR)

install: $(PROGRAM)
@[ $(shell id -u) -eq 0 ] || (echo "Error: install needs root privileges" && false)
@mkdir -vp $(PREFIX)/bin $(PREFIX)/share/DediProg
@echo -n "install: " && install -v -o 0 -g 0 -m 0755 $(PROGRAM) $(PREFIX)/bin/$(PROGRAM)
[ $(shell id -u) -eq 0 ] || (echo "Error: install needs root privileges" && false)
mkdir -vp $(PREFIX)/bin $(PREFIX)/share/DediProg
echo -n "install: " && install -v -o 0 -g 0 -m 0755 $(PROGRAM) $(PREFIX)/bin/$(PROGRAM)
strip $(PREFIX)/bin/$(PROGRAM)
@echo -n "install: " && install -v -o 0 -g 0 -m 0644 ChipInfoDb.dedicfg $(PREFIX)/share/DediProg/ChipInfoDb.dedicfg
@echo -n "install: " && install -v -o 0 -g 0 -m 0644 60-dediprog.rules /etc/udev/rules.d/60-dediprog.rules
echo -n "install: " && install -v -o 0 -g 0 -m 0644 ChipInfoDb.dedicfg $(PREFIX)/share/DediProg/ChipInfoDb.dedicfg
echo -n "install: " && install -v -o 0 -g 0 -m 0644 60-dediprog.rules /etc/udev/rules.d/60-dediprog.rules

uninstall:
@[ $(shell id -u) -eq 0 ] || (echo "Error: uninstall needs root privileges" && false)
@rm -vf $(PREFIX)/bin/$(PROGRAM) $(PREFIX)/share/DediProg/ChipInfoDb.dedicfg /etc/udev/rules.d/60-dediprog.rules
@[ -d "$(PREFIX)/share/DediProg" ] && rmdir -v $(PREFIX)/share/DediProg || true
[ $(shell id -u) -eq 0 ] || (echo "Error: uninstall needs root privileges" && false)
rm -vf $(PREFIX)/bin/$(PROGRAM) $(PREFIX)/share/DediProg/ChipInfoDb.dedicfg /etc/udev/rules.d/60-dediprog.rules
[ -d "$(PREFIX)/share/DediProg" ] && rmdir -v $(PREFIX)/share/DediProg || true

0 comments on commit ec86ad4

Please sign in to comment.