Skip to content

Commit 4646801

Browse files
committed
Make build output quieter.
Use make V=1e make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity. This should fix issue adafruit#117
1 parent 6c73ca1 commit 4646801

5 files changed

Lines changed: 91 additions & 36 deletions

File tree

py/py.mk

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
##########
2+
# The following should eventually go into a more central location
3+
# when a reorg is done.
4+
#
5+
# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
6+
# Makefile or in your environment. You can also use V=1 on the make command
7+
# line.
8+
ifeq ("$(origin V)", "command line")
9+
BUILD_VERBOSE=$(V)
10+
endif
11+
ifndef BUILD_VERBOSE
12+
BUILD_VERBOSE = 0
13+
endif
14+
ifeq ($(BUILD_VERBOSE),0)
15+
Q = @
16+
else
17+
Q =
18+
endif
19+
# Since this is a new feature, advertise it
20+
ifeq ($(BUILD_VERBOSE),0)
21+
$(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.)
22+
endif
23+
#
24+
#########
25+
126
# default settings; can be overriden in main Makefile
227

328
ifndef PY_SRC
@@ -11,7 +36,7 @@ endif
1136
# to create the build directory
1237

1338
$(BUILD):
14-
mkdir -p $@
39+
$(Q)mkdir -p $@
1540

1641
# where py object files go (they have a name prefix to prevent filename clashes)
1742

@@ -80,24 +105,30 @@ PY_O_BASENAME = \
80105
PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME))
81106

82107
$(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
83-
$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
108+
$(ECHO) "CC $<"
109+
$(Q)$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
84110

85111
$(PY_BUILD)emitnthumb.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
86-
$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
112+
$(ECHO) "CC $<"
113+
$(Q)$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
87114

88115
$(PY_BUILD)%.o: $(PY_SRC)/%.S
89-
$(CC) $(CFLAGS) -c -o $@ $<
116+
$(ECHO) "CC $<"
117+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
90118

91119
$(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h
92-
$(CC) $(CFLAGS) -c -o $@ $<
120+
$(ECHO) "CC $<"
121+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
93122

94123
# optimising gc for speed; 5ms down to 4ms on pybv2
95124
$(PY_BUILD)gc.o: $(PY_SRC)/gc.c
96-
$(CC) $(CFLAGS) -O3 -c -o $@ $<
125+
$(ECHO) "CC $<"
126+
$(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
97127

98128
# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
99129
$(PY_BUILD)vm.o: $(PY_SRC)/vm.c
100-
$(CC) $(CFLAGS) -O3 -c -o $@ $<
130+
$(ECHO) "CC $<"
131+
$(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $<
101132

102133
# header dependencies
103134

stm/Makefile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include ../py/py.mk
66

77
# program for deletion
88
RM = /bin/rm
9+
ECHO = @echo
910

1011
STMSRC=lib
1112
#STMOTGSRC=lib-otg
@@ -115,35 +116,43 @@ OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_FATFS:.c=.o) $(
115116
all2: $(BUILD) $(BUILD)/flash.dfu
116117

117118
$(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin
118-
python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
119+
$(ECHO) "Create $@"
120+
$(Q)python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
119121

120122
$(BUILD)/flash0.bin: $(BUILD)/flash.elf
121-
$(OBJCOPY) -O binary -j .isr_vector $^ $@
123+
$(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $@
122124

123125
$(BUILD)/flash1.bin: $(BUILD)/flash.elf
124-
$(OBJCOPY) -O binary -j .text -j .data $^ $@
126+
$(Q)$(OBJCOPY) -O binary -j .text -j .data $^ $@
125127

126128
$(BUILD)/flash.elf: $(OBJ)
127-
$(LD) $(LDFLAGS) -o $@ $(OBJ)
128-
$(SIZE) $@
129+
$(ECHO) "LINK $@"
130+
$(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ)
131+
$(Q)$(SIZE) $@
129132

130133
$(BUILD)/%.o: %.s
131-
$(AS) -o $@ $<
134+
$(ECHO) "AS $<"
135+
$(Q)$(AS) -o $@ $<
132136

133137
$(BUILD)/%.o: %.c
134-
$(CC) $(CFLAGS) -c -o $@ $<
138+
$(ECHO) "CC $<"
139+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
135140

136141
$(BUILD)/%.o: $(FATFSSRC)/%.c
137-
$(CC) $(CFLAGS) -c -o $@ $<
142+
$(ECHO) "CC $<"
143+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
138144

139145
$(BUILD)/%.o: $(STMSRC)/%.c
140-
$(CC) $(CFLAGS) -c -o $@ $<
146+
$(ECHO) "CC $<"
147+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
141148

142149
#$(BUILD)/%.o: $(STMOTGSRC)/%.c
143-
# $(CC) $(CFLAGS) -c -o $@ $<
150+
# $(ECHO) "CC $<"
151+
# $(Q)$(CC) $(CFLAGS) -c -o $@ $<
144152

145153
$(BUILD)/%.o: $(CC3KSRC)/%.c
146-
$(CC) $(CFLAGS) -c -o $@ $<
154+
$(ECHO) "CC $<"
155+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
147156

148157
clean:
149158
$(RM) -rf $(BUILD)

teensy/Makefile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include ../py/py.mk
66

77
# program for deletion
88
RM = /bin/rm
9+
ECHO = @echo
910

1011
ifeq ($(ARDUINO),)
1112
$(error Please define ARDUINO (where TeensyDuino is installed))
@@ -62,35 +63,43 @@ all2: $(BUILD) hex
6263
hex: $(BUILD)/flash.hex
6364

6465
post_compile: $(BUILD)/flash.hex
65-
$(TOOLS_PATH)/teensy_post_compile -file="$(basename $<)" -path="$(BUILD)" -tools="$(TOOLS_PATH)"
66+
$(ECHO) "Preparing $@ for upload"
67+
$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(<D)" -tools="$(TOOLS_PATH)"
6668

6769
reboot:
68-
-$(TOOLS_PATH)/teensy_reboot
70+
$(ECHO) "REBOOT"
71+
-$(Q)$(TOOLS_PATH)/teensy_reboot
6972

7073
upload: post_compile reboot
7174

7275
$(BUILD)/flash.elf: $(OBJ)
73-
$(CC) $(LDFLAGS) -o "$@" -Wl,-Map,$(@:.elf=.map) $(OBJ) $(LIBS)
74-
$(SIZE) $@
76+
$(ECHO) "LINK $<"
77+
$(Q)$(CC) $(LDFLAGS) -o "$@" -Wl,-Map,$(@:.elf=.map) $(OBJ) $(LIBS)
78+
$(Q)$(SIZE) $@
7579

7680
$(BUILD)/%.hex: $(BUILD)/%.elf
77-
$(OBJCOPY) -O ihex -R .eeprom "$<" "$@"
81+
$(ECHO) "HEX $<"
82+
$(Q)$(OBJCOPY) -O ihex -R .eeprom "$<" "$@"
7883

7984
$(BUILD)/%.o: %.c
80-
$(CC) $(CFLAGS) -c -o $@ $<
85+
$(ECHO) "CC $<"
86+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
8187

8288
$(BUILD)/%.o: ../stm/%.s
83-
$(AS) -o $@ $<
89+
$(ECHO) "AS $<"
90+
$(Q)$(AS) -o $@ $<
8491

8592
$(BUILD)/%.o: ../stm/%.c
86-
$(CC) $(CFLAGS) -c -o $@ $<
93+
$(ECHO) "CC $<"
94+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
8795

8896
$(BUILD)/%.o: $(CORE_PATH)/%.c
89-
$(CC) $(CFLAGS) -c -o $@ $<
97+
$(ECHO) "CC $<"
98+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
9099

91100
$(BUILD)/main.o: mpconfigport.h
92101

93102
clean:
94-
/bin/rm -rf $(BUILD)
103+
$(RM) -rf $(BUILD)
95104

96105
.PHONY: all all2 clean

unix-cpy/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include ../py/py.mk
77

88
# program for deletion
99
RM = /bin/rm
10+
ECHO = @echo
1011

1112
# compiler settings
1213
CC = gcc
@@ -21,12 +22,14 @@ OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) $(PY_O)
2122
LIB =
2223

2324
$(PROG): $(BUILD) $(OBJ)
24-
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
25-
strip $(PROG)
26-
size $(PROG)
25+
$(ECHO) "LINK $<"
26+
$(Q)$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
27+
$(Q)strip $(PROG)
28+
$(Q)size $(PROG)
2729

2830
$(BUILD)/%.o: %.c
29-
$(CC) $(CFLAGS) -c -o $@ $<
31+
$(ECHO) "CC $<"
32+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
3033

3134
$(BUILD)/main.o: mpconfigport.h
3235

unix/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include ../py/py.mk
77

88
# program for deletion
99
RM = /bin/rm
10+
ECHO = @echo
1011

1112
# compiler settings
1213
CC = gcc
@@ -24,12 +25,14 @@ LIB = -lreadline
2425
#LIB += -ltermcap
2526

2627
$(PROG): $(BUILD) $(OBJ)
27-
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
28-
strip $(PROG)
29-
size $(PROG)
28+
$(ECHO) "LINK $<"
29+
$(Q)$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
30+
$(Q)strip $(PROG)
31+
$(Q)size $(PROG)
3032

3133
$(BUILD)/%.o: %.c
32-
$(CC) $(CFLAGS) -c -o $@ $<
34+
$(ECHO) "CC $<"
35+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
3336

3437
$(BUILD)/main.o: mpconfigport.h
3538

0 commit comments

Comments
 (0)