69 lines
1.5 KiB
Makefile
69 lines
1.5 KiB
Makefile
|
# Output directory and files
|
||
|
ifeq ($(BUILDDIR),)
|
||
|
BUILDDIR = build
|
||
|
endif
|
||
|
ifeq ($(BUILDDIR),.)
|
||
|
BUILDDIR = build
|
||
|
endif
|
||
|
OUTFILES = $(BUILDDIR)/$(PROJECT)
|
||
|
|
||
|
|
||
|
# Source files groups and paths
|
||
|
ifeq ($(USE_THUMB),yes)
|
||
|
TCSRC += $(CSRC)
|
||
|
TCPPSRC += $(CPPSRC)
|
||
|
else
|
||
|
ACSRC += $(CSRC)
|
||
|
ACPPSRC += $(CPPSRC)
|
||
|
endif
|
||
|
ASRC = $(ACSRC)$(ACPPSRC)
|
||
|
TSRC = $(TCSRC)$(TCPPSRC)
|
||
|
SRCPATHS = $(sort $(dir $(ASMXSRC)) $(dir $(ASMSRC)) $(dir $(ASRC)) $(dir $(TSRC)))
|
||
|
|
||
|
# Various directories
|
||
|
OBJDIR = $(BUILDDIR)/obj
|
||
|
LSTDIR = $(BUILDDIR)/lst
|
||
|
|
||
|
|
||
|
# Object files groups
|
||
|
ACOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ACSRC:.c=.o)))
|
||
|
TCOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCSRC:.c=.o)))
|
||
|
TCPPOBJS = $(addprefix $(OBJDIR)/, $(notdir $(TCPPSRC:.cpp=.o)))
|
||
|
ASMOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMSRC:.s=.o)))
|
||
|
ASMXOBJS = $(addprefix $(OBJDIR)/, $(notdir $(ASMXSRC:.S=.o)))
|
||
|
OBJS = $(ASMXOBJS) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS)
|
||
|
|
||
|
|
||
|
#
|
||
|
# Makefile rules
|
||
|
#
|
||
|
|
||
|
all: $(OBJS) $(OUTFILES) MAKE_ALL_RULE_HOOK
|
||
|
|
||
|
MAKE_ALL_RULE_HOOK:
|
||
|
|
||
|
$(OBJS): | $(BUILDDIR)
|
||
|
|
||
|
$(BUILDDIR) $(OBJDIR) $(LSTDIR):
|
||
|
ifneq ($(USE_VERBOSE_COMPILE),yes)
|
||
|
@echo Compiler Options
|
||
|
@echo $(CPPC) -c $(CPPFLAGS) -I. $(IINCDIR) main.cpp -o main.o
|
||
|
@echo
|
||
|
endif
|
||
|
mkdir -p $(OBJDIR)
|
||
|
mkdir -p $(LSTDIR)
|
||
|
|
||
|
$(BUILDDIR)/$(PROJECT): $(OBJS)
|
||
|
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
||
|
@echo
|
||
|
$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
||
|
else
|
||
|
@echo Linking $@
|
||
|
@$(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
||
|
endif
|
||
|
|
||
|
clean:
|
||
|
@echo Cleaning
|
||
|
-rm -fR .dep $(BUILDDIR)
|
||
|
@echo Done
|