-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Refector Makefile #786
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not expect you to necessarily address the code comments. They are just thoughts about the build system in general and things that are worth thinking about how we could improve.
########################################### | ||
## Provide some convenient make targets ## | ||
########################################### | ||
ifndef TARGET | ||
TARGET ?= devo8 | ||
default: $(TARGET) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get rid of the default. running make without a target should just fail.
src/Makefile
Outdated
rm -f $(TARGET).$(EXEEXT) $(TARGET).exe $(TARGET).bin $(TARGET).dfu $(TARGET).list \ | ||
$(TARGET).map $(ODIR)/*.o $(ODIR)/*.o_ $(ODIR)/*.P $(ODIR)/*.bin \ | ||
filesystem/$(FILESYSYTEM) 2> /dev/null || true | ||
$(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t,$(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(TARGET)))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right...how does $TARGET get set here?
src/Makefile.inc
Outdated
$(wildcard $(SDIR)/config/*.c) | ||
|
||
ifdef MODULAR | ||
SRC_C += $(SDIR)/protocol/protocol.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never liked this. Modular builds are a target thing, and don't belong in the main makefile. but it is weird because the protocol code itself is here. I'm not sure what to do about it.
# Note that this must be after the 1st rule so that it doesn't execute by default# | ||
################################################################################## | ||
$(VERBOSE).SILENT: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the thinks I hate about Makefiles. why does the order of things like this matter? it is completely non-intuitive
zip: $(TARGET).zip | ||
|
||
%.zip: $(ALL) $(TARGET).dfu $(PROTO_MODULES) | ||
#This is not an emulator build (emulator is hanled in target/common/emu/Makefile.inc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knowledge of anything dfu related is target based and shouldn't be in the main file....but tis the general zip logic common to all tx? it is different for emus....it is at least somewhat different for radiolnk and opentx. Not sure if we can break this up or move it without making it either duplicated or hard to read.
src/Makefile.inc
Outdated
#The main executable # | ||
###################### | ||
$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) | ||
@echo " + Building '$@'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libopencm3 stuff is target related. it really doesn't belong in the main makefile. except that it currently lives in the src/ directory. maybe it should go into a libs/ directory or under target somewhere...I dunno
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. we can. we need first define the MACROs and document somewhere. then the code can be much clean.
src/Makefile.inc
Outdated
|
||
# Use VERBOSE=1 to enable verbose make | ||
PROGMODE ?= STATUS_SCREEN | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? I can't find any reference to it anywhere else. No idea why we have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't know.
Move distclean to root Makefile Fix emu_devo8 move back from firmware
ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it | ||
echo "" > $(ODIR)optimize.ld | ||
endif | ||
ifeq ("$(SRC_CXX)", "") | ||
$(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) | ||
$(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name his better? I have no idea what the difference is between LFLAGS and LFLAGS2 (Yes I know you didn't create it, but now is a good time to fix it)
@@ -8,4 +8,7 @@ LANGUAGE := devo10 | |||
|
|||
OPTIMIZE_DFU := 1 | |||
|
|||
TARGET=devo10 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do I need this in every Makefile? Isn't it inferrable by the directory I'm in? The less things I need to define the better.
On the other hand, hiding away definitions makes things harder to read...I'm torn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I struggled as well.
I can pass TARGET from Makefile, maybe I should do that.
EMUS = $(foreach dir,$(TXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) | ||
ALLEMUS = $(foreach dir,$(ALLTXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) | ||
EMUS = $(addprefix emu_, $(TXS)) | ||
ALLEMUS = $(addprefix emu_, $(ALLTXS)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work if not every target has an emu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to filter out some targets. but since we put target under family, it is a challenge to do so.
|
||
include target/drivers/mcu/emu/Makefile.inc | ||
SRC += $(SDIR)/target/tx/devo/devof7/ia9211_map.c | ||
CFLAGS +=-I$(SDIR)/target/drivers/display/spi/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird to me. the ia9211_map file is emu only but lives in the devof7 dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. it is a include file used by devof7 lcd driver as well.
No description provided.