1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-20 07:32:10 +00:00
stmbl/base.mak

63 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2016-01-21 13:34:14 +00:00
# Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1)
Q := @
NULL := 2>/dev/null
endif
2015-12-30 07:14:51 +00:00
# Link: create ELF output file from object files
#
$(TARGET).elf: $(OBJECTS) $(LDSCRIPT)
@echo Linking: $@
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(CC) $(OBJECTS) $(LDFLAGS) --output $(basename $@).tmp
2015-12-30 07:14:51 +00:00
@echo Post-processing: $@
2016-01-21 13:34:14 +00:00
$(Q)$(POSTLD) $(basename $@).tmp $@
2015-12-30 07:14:51 +00:00
# Create extended listing file from ELF output file
#
%.lss: %.elf
@echo Creating Extended Listing: $@
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(OBJDUMP) -h -S -z $< > $@
2015-12-30 07:14:51 +00:00
# Create a symbol table from ELF output file
#
%.sym: %.elf
@echo Creating Symbol Table: $@
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(NM) -n $< > $@
2015-12-30 07:14:51 +00:00
# Create final output files from ELF output file.
#
%.hex: %.elf
@echo Creating hex file: $@
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(OBJCOPY) -O ihex $< $@
2015-12-30 07:14:51 +00:00
# Create binary output file from ELF output file.
#
%.bin: %.elf
@echo Creating bin file: $@
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(OBJCOPY) -O binary --gap-fill 0xFF $< $@
2015-12-30 07:14:51 +00:00
# Compile: create object files from C source files
#
$(OBJDIR)/%.o : %.c
@echo Compiling C: $<
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $(GENDEPFLAGS) $< -o $@
2015-12-30 07:14:51 +00:00
$(OBJDIR)/%.o : %.cpp
@echo Compiling C++: $<
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(CC) -c $(CPPFLAGS) $(CXXFLAGS) $(GENDEPFLAGS) $< -o $@
2015-12-30 07:14:51 +00:00
# Assemble: create object files from assembler source files
#
$(OBJDIR)/%.o : %.s
@echo Assembling: $<
@$(MKDIR) -p $(dir $@)
2016-01-21 13:34:14 +00:00
$(Q)$(CC) -c $(CPPFLAGS) $(ASFLAGS) $(GENDEPFLAGS) $< -o $@