-
Notifications
You must be signed in to change notification settings - Fork 2
/
base.mak
65 lines (57 loc) · 1.38 KB
/
base.mak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Link: create ELF output file from object files
#
$(TARGET).elf: $(OBJECTS) $(LDSCRIPT)
@echo
@echo Linking: $@
@$(MKDIR) -p $(dir $@)
$(CC) $(OBJECTS) $(LDFLAGS) --output $(basename $@).tmp
@echo
@echo Post-processing: $@
$(POSTLD) $(basename $@).tmp $@
# Create extended listing file from ELF output file
#
%.lss: %.elf
@echo
@echo Creating Extended Listing: $@
@$(MKDIR) -p $(dir $@)
$(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file
#
%.sym: %.elf
@echo
@echo Creating Symbol Table: $@
@$(MKDIR) -p $(dir $@)
$(NM) -n $< > $@
# Create final output files from ELF output file.
#
%.hex: %.elf
@echo
@echo Creating hex file: $@
@$(MKDIR) -p $(dir $@)
$(OBJCOPY) -O ihex $< $@
# Create binary output file from ELF output file.
#
%.bin: %.elf
@echo
@echo Creating bin file: $@
@$(MKDIR) -p $(dir $@)
$(OBJCOPY) -O binary --gap-fill 0xFF $< $@
# Compile: create object files from C source files
#
$(OBJDIR)/%.o : %.c
@echo
@echo Compiling C: $<
@$(MKDIR) -p $(dir $@)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(GENDEPFLAGS) $< -o $@
$(OBJDIR)/%.o : %.cpp
@echo
@echo Compiling C++: $<
@$(MKDIR) -p $(dir $@)
$(CC) -c $(CPPFLAGS) $(CXXFLAGS) $(GENDEPFLAGS) $< -o $@
# Assemble: create object files from assembler source files
#
$(OBJDIR)/%.o : %.s
@echo
@echo Assembling: $<
@$(MKDIR) -p $(dir $@)
$(CC) -c $(CPPFLAGS) $(ASFLAGS) $(GENDEPFLAGS) $< -o $@