2013-10-29 10:26:19 +00:00
|
|
|
#
|
|
|
|
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
|
|
|
|
#
|
|
|
|
##############################################################################################
|
|
|
|
#
|
|
|
|
# On command line:
|
|
|
|
#
|
|
|
|
# make all = Create project
|
|
|
|
#
|
|
|
|
# make clean = Clean project files.
|
|
|
|
#
|
|
|
|
# To rebuild project do "make clean" and "make all".
|
|
|
|
#
|
|
|
|
|
2014-09-26 06:27:34 +00:00
|
|
|
##############################################################################################
|
|
|
|
# Start of make control
|
|
|
|
#
|
|
|
|
|
|
|
|
# Turn ChibiOS simimulator on or off?
|
|
|
|
USE_CHIBIOS=no
|
|
|
|
|
|
|
|
# Verbose compiling?
|
|
|
|
USE_VERBOSE_COMPILE=no
|
|
|
|
|
|
|
|
# Generate listing files?
|
|
|
|
USE_LISTING=no
|
|
|
|
|
|
|
|
# Your project name and executable file name - Optional, defaults to the project directory name
|
|
|
|
#PROJECT=uGFX
|
|
|
|
|
|
|
|
#
|
|
|
|
# End of make control
|
|
|
|
##############################################################################################
|
|
|
|
|
2013-10-29 10:26:19 +00:00
|
|
|
##############################################################################################
|
|
|
|
# Start of default section
|
|
|
|
#
|
|
|
|
|
|
|
|
CC = i686-pc-mingw32-gcc -g
|
|
|
|
|
|
|
|
# List all default C defines here, like -D_DEBUG=1
|
|
|
|
DDEFS =
|
|
|
|
|
|
|
|
# List all default directories to look for include files here
|
|
|
|
DINCDIR =
|
|
|
|
|
|
|
|
# List the default directory to look for the libraries here
|
|
|
|
DLIBDIR =
|
|
|
|
|
|
|
|
# List all default libraries here
|
2013-12-22 11:38:57 +00:00
|
|
|
DLIBS = -lws2_32 -lgdi32 -lwinmm
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
# Make sure this empty for now
|
2014-09-26 06:27:34 +00:00
|
|
|
SRC =
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# End of default section
|
|
|
|
##############################################################################################
|
|
|
|
|
|
|
|
##############################################################################################
|
|
|
|
# Start of user section
|
|
|
|
#
|
|
|
|
|
|
|
|
# Imported source files and paths for uGFX
|
|
|
|
GFXLIB = ../uGFX
|
|
|
|
include $(GFXLIB)/gfx.mk
|
|
|
|
include $(GFXLIB)/boards/base/Win32/board.mk
|
|
|
|
|
|
|
|
# Imported source files and paths for ChibiOS
|
|
|
|
ifeq ($(USE_CHIBIOS),yes)
|
|
|
|
CHIBIOS = ../ChibiOS
|
|
|
|
include $(CHIBIOS)/boards/simulator/board.mk
|
|
|
|
include ${CHIBIOS}/os/hal/hal.mk
|
|
|
|
include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk
|
|
|
|
include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk
|
|
|
|
include ${CHIBIOS}/os/kernel/kernel.mk
|
|
|
|
DDEFS += -DSIMULATOR -DSHELL_USE_IPRINTF=FALSE
|
|
|
|
UINCDIR += $(PORTINC) $(KERNINC) $(TESTINC) \
|
|
|
|
$(HALINC) $(PLATFORMINC) $(BOARDINC)
|
|
|
|
# ${CHIBIOS}/os/various
|
|
|
|
SRC += ${PORTSRC} \
|
|
|
|
${KERNSRC} \
|
|
|
|
${TESTSRC} \
|
|
|
|
${HALSRC} \
|
|
|
|
${PLATFORMSRC} \
|
|
|
|
$(BOARDSRC)
|
|
|
|
GFXDEFS += -DGFX_USE_OS_CHIBIOS=TRUE
|
|
|
|
else
|
|
|
|
GFXDEFS += -DGFX_USE_OS_WIN32=TRUE
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Where is our source code - alter these for your project.
|
2014-02-18 14:19:38 +00:00
|
|
|
# Either just include the demo makefile or add your own definitions
|
|
|
|
include $(GFXLIB)/demos/modules/gdisp/basics/demo.mk
|
|
|
|
#MYFILES = my-project-directory
|
|
|
|
#MYCSRC = $(MYFILES)/main.c
|
|
|
|
#MYDEFS =
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
# List C source files here
|
|
|
|
SRC += ${GFXSRC} \
|
|
|
|
${MYCSRC}
|
|
|
|
|
|
|
|
# List all user C define here, like -D_DEBUG=1
|
|
|
|
UDEFS = ${GFXDEFS}
|
|
|
|
|
|
|
|
# List all user directories here
|
|
|
|
UINCDIR = ${GFXINC} \
|
|
|
|
${MYFILES}
|
|
|
|
|
|
|
|
# List the user directory to look for the libraries here
|
|
|
|
ULIBDIR =
|
|
|
|
|
|
|
|
# List all user libraries here
|
|
|
|
ULIBS =
|
|
|
|
|
|
|
|
# Define optimisation level here
|
|
|
|
#OPT = -ggdb -O2 -fomit-frame-pointer
|
|
|
|
OPT = -ggdb -O0 -fomit-frame-pointer
|
|
|
|
|
|
|
|
#
|
|
|
|
# End of user defines
|
|
|
|
##############################################################################################
|
|
|
|
|
|
|
|
|
2014-09-26 06:27:34 +00:00
|
|
|
# Default project name is the project directory name
|
|
|
|
ifeq ($(PROJECT),)
|
|
|
|
PROJECT := $(notdir $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST))))))
|
|
|
|
endif
|
|
|
|
|
2013-10-29 10:26:19 +00:00
|
|
|
# Output directory and files
|
2014-09-26 06:27:34 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),Debug)
|
|
|
|
BUILDDIR = bin/Debug
|
|
|
|
else ifeq ($(MAKECMDGOALS),Release)
|
|
|
|
BUILDDIR = bin/Release
|
|
|
|
else ifeq ($(BUILDDIR),)
|
2013-10-29 10:26:19 +00:00
|
|
|
BUILDDIR = .build
|
2014-09-26 06:27:34 +00:00
|
|
|
else ifeq ($(BUILDDIR),.)
|
2013-10-29 10:26:19 +00:00
|
|
|
BUILDDIR = .build
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJDIR = $(BUILDDIR)/obj
|
|
|
|
LSTDIR = $(BUILDDIR)/lst
|
|
|
|
MAPDIR = $(BUILDDIR)/map
|
2014-09-26 06:27:34 +00:00
|
|
|
DEPDIR = .dep
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
|
|
|
|
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
|
|
|
|
DEFS = $(DDEFS) $(UDEFS)
|
|
|
|
ADEFS = $(DADEFS) $(UADEFS)
|
2014-09-26 06:27:34 +00:00
|
|
|
COBJ = $(addprefix $(OBJDIR)/, $(subst ../,_dot_dot/,$(SRC:.c=.o)))
|
|
|
|
AOBJ = $(addprefix $(OBJDIR)/, $(subst ../,_dot_dot/,$(ASRC:.s=.o)))
|
2013-10-29 10:26:19 +00:00
|
|
|
OBJS = $(AOBJ) $(COBJ)
|
|
|
|
LIBS = $(DLIBS) $(ULIBS)
|
|
|
|
|
|
|
|
LDFLAGS = -Wl,-Map=$(MAPDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
|
2014-09-26 06:27:34 +00:00
|
|
|
CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm $(DEFS)
|
|
|
|
ifeq ($(USE_LISTING),yes)
|
|
|
|
CPFLAGS += -Wa,-alms=$(LSTDIR)/$(<:.c=.lst)
|
|
|
|
endif
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
# Generate dependency information
|
2014-09-26 06:27:34 +00:00
|
|
|
CPFLAGS += -MD -MP -MF $(DEPDIR)/$(@F).d
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# makefile rules
|
|
|
|
#
|
|
|
|
|
2014-09-26 06:27:34 +00:00
|
|
|
Debug Release: all
|
|
|
|
|
|
|
|
cleanDebug cleanRelease: clean
|
|
|
|
-rm -fR bin
|
|
|
|
|
2013-10-29 10:26:19 +00:00
|
|
|
all: $(BUILDDIR) $(OBJS) $(BUILDDIR)/$(PROJECT).exe MAKE_ALL_RULE_HOOK
|
2014-09-26 06:27:34 +00:00
|
|
|
#all: main.cp
|
|
|
|
|
|
|
|
main.cp: $(MYCSRC)
|
|
|
|
$(CC) -c $(CPFLAGS) -E -P -I. $(INCDIR) $< -o $@
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
MAKE_ALL_RULE_HOOK:
|
|
|
|
|
|
|
|
$(BUILDDIR) $(OBJDIR) $(LSTDIR):
|
|
|
|
mkdir -p $(OBJDIR)
|
|
|
|
mkdir -p $(MAPDIR)
|
2014-09-26 06:27:34 +00:00
|
|
|
ifeq ($(USE_LISTING),yes)
|
|
|
|
mkdir -p $(LSTDIR)
|
|
|
|
endif
|
2013-10-29 10:26:19 +00:00
|
|
|
ifneq ($(USE_VERBOSE_COMPILE),yes)
|
|
|
|
@echo Compiler Options - $(CC) -c $(CPFLAGS) -I. $(INCDIR) main.c -o $(OBJDIR)/main.o
|
|
|
|
@echo
|
|
|
|
endif
|
|
|
|
|
2014-09-26 06:27:34 +00:00
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(OBJDIR)/%.o : $$(subst _dot_dot/,../,%.c)
|
2013-10-29 10:26:19 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
|
|
|
@echo
|
|
|
|
$(CC) -c $(CPFLAGS) -I. $(INCDIR) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(CC) -c $(CPFLAGS) -I. $(INCDIR) $< -o $@
|
|
|
|
endif
|
|
|
|
|
2014-09-26 06:27:34 +00:00
|
|
|
$(OBJDIR)/%.o : $$(subst _dot_dot/,../,%.s)
|
2013-10-29 10:26:19 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
|
|
|
@echo
|
|
|
|
$(AS) -c $(ASFLAGS) -I. $(INCDIR) $< -o $@
|
|
|
|
else
|
|
|
|
@echo Compiling $<
|
|
|
|
@$(AS) -c $(ASFLAGS) -I. $(INCDIR) $< -o $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.exe: $(OBJS)
|
|
|
|
ifeq ($(USE_VERBOSE_COMPILE),yes)
|
|
|
|
@echo
|
|
|
|
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
|
|
|
else
|
|
|
|
@echo Linking $@
|
|
|
|
@$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
gcov:
|
|
|
|
-mkdir gcov
|
|
|
|
$(COV) -u $(subst /,\,$(SRC))
|
|
|
|
-mv *.gcov ./gcov
|
|
|
|
|
|
|
|
clean:
|
2014-09-26 06:27:34 +00:00
|
|
|
-rm -fR $(BUILDDIR)
|
|
|
|
-rm -fR $(DEPDIR)
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Include the dependency files, should be the last of the makefile
|
|
|
|
#
|
2014-09-26 06:27:34 +00:00
|
|
|
-include $(shell mkdir $(DEPDIR) 2>/dev/null) $(wildcard $(DEPDIR)/*)
|
2013-10-29 10:26:19 +00:00
|
|
|
|
|
|
|
# *** EOF ***
|