mirror of
https://github.com/QuantumLeaps/qpcpp.git
synced 2025-01-14 05:42:57 +08:00
192 lines
5.0 KiB
Makefile
192 lines
5.0 KiB
Makefile
##############################################################################
|
|
# Product: Makefile for QUTEST, QP/C++, Win32, MinGW toolset
|
|
# Last Updated for Version: 6.3.8
|
|
# Date of the Last Update: 2019-01-09
|
|
#
|
|
# Q u a n t u m L e a P s
|
|
# ------------------------
|
|
# Modern Embedded Software
|
|
#
|
|
# Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved.
|
|
#
|
|
# This program is open source software: you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Alternatively, this program may be distributed and modified under the
|
|
# terms of Quantum Leaps commercial licenses, which expressly supersede
|
|
# the GNU General Public License and are specifically designed for
|
|
# licensees interested in retaining the proprietary status of their code.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Contact information:
|
|
# https://www.state-machine.com
|
|
# mailto:info@state-machine.com
|
|
##############################################################################
|
|
# examples of invoking this Makefile:
|
|
# make
|
|
#
|
|
# cleaning
|
|
# make clean
|
|
#
|
|
# NOTE:
|
|
# To use this Makefile on Windows, you will need the GNU make utility, which
|
|
# is included in the Qtools collection for Windows, see:
|
|
# https://sourceforge.net/projects/qpc/files/QTools/
|
|
#
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# project name:
|
|
#
|
|
PROJECT := qp
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# project directories:
|
|
#
|
|
|
|
# location of the QP/C++ framework
|
|
QPCPP := ../..
|
|
|
|
# QP port used in this project
|
|
QP_PORT_DIR := .
|
|
|
|
|
|
# list of all source directories used by this project
|
|
VPATH = \
|
|
$(QPCPP)/src/qf \
|
|
$(QPCPP)/src/qs \
|
|
$(QP_PORT_DIR)
|
|
|
|
# list of all include directories needed by this project
|
|
INCLUDES = \
|
|
-I$(QPCPP)/include \
|
|
-I$(QPCPP)/src \
|
|
-I$(QP_PORT_DIR)
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# files
|
|
#
|
|
|
|
# C source files
|
|
C_SRCS :=
|
|
|
|
# C++ source files
|
|
CPP_SRCS := \
|
|
qep_hsm.cpp \
|
|
qep_msm.cpp \
|
|
qf_act.cpp \
|
|
qf_actq.cpp \
|
|
qf_defer.cpp \
|
|
qf_dyn.cpp \
|
|
qf_mem.cpp \
|
|
qf_ps.cpp \
|
|
qf_qact.cpp \
|
|
qf_qeq.cpp \
|
|
qf_qmact.cpp \
|
|
qf_time.cpp \
|
|
qs.cpp \
|
|
qs_64bit.cpp \
|
|
qs_rx.cpp \
|
|
qs_fp.cpp \
|
|
qutest.cpp \
|
|
qutest_port.cpp
|
|
|
|
# defines:
|
|
DEFINES := -DQ_SPY -DQ_UTEST -DQ_HOST
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# MinGW toolset (NOTE: assumed to be on your PATH)
|
|
#
|
|
# NOTE:
|
|
# MinGW toolset is included in the Qtools collection for Windows, see:
|
|
# http://sourceforge.net/projects/qpc/files/Qtools/
|
|
|
|
CC := gcc
|
|
CPP := g++
|
|
LIB := ar
|
|
|
|
|
|
##############################################################################
|
|
# Typically, you should not need to change anything below this line
|
|
|
|
# basic utilities (included in Qtools for Windows), see:
|
|
# http://sourceforge.net/projects/qpc/files/Qtools
|
|
|
|
MKDIR := mkdir
|
|
RM := rm
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# build options:
|
|
#
|
|
|
|
LIBFLAGS := rs
|
|
|
|
BIN_DIR = mingw
|
|
|
|
# gcc options:
|
|
CFLAGS := -c -ffunction-sections -fdata-sections \
|
|
-std=c99 -pedantic -Wall -Wextra \
|
|
-O $(INCLUDES) $(DEFINES)
|
|
|
|
CPPFLAGS := -c -ffunction-sections -fdata-sections \
|
|
-std=c++11 -pedantic -fno-rtti -fno-exceptions -Wall -Wextra \
|
|
-O $(INCLUDES) $(DEFINES)
|
|
|
|
|
|
C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS)))
|
|
CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS)))
|
|
|
|
TARGET_LIB := $(BIN_DIR)/lib$(PROJECT).a
|
|
C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS))
|
|
CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS))
|
|
|
|
# create $(BIN_DIR) if it does not exist
|
|
ifeq ("$(wildcard $(BIN_DIR))","")
|
|
$(shell $(MKDIR) $(BIN_DIR))
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# rules
|
|
#
|
|
|
|
all: $(TARGET_LIB)
|
|
-$(RM) $(BIN_DIR)/*.o
|
|
|
|
$(TARGET_LIB) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT)
|
|
$(LIB) $(LIBFLAGS) $@ $^
|
|
|
|
$(BIN_DIR)/%.o : %.c
|
|
$(CC) $(CFLAGS) $< -o $@
|
|
|
|
$(BIN_DIR)/%.o : %.cpp
|
|
$(CPP) $(CPPFLAGS) $< -o $@
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# the clean target
|
|
#
|
|
.PHONY : clean
|
|
clean:
|
|
-$(RM) $(BIN_DIR)/*.o $(TARGET_LIB)
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# the show target for debugging
|
|
#
|
|
show:
|
|
@echo PROJECT = $(PROJECT)
|
|
@echo CONF = $(CONF)
|
|
@echo TARGET_LIB = $(TARGET_LIB)
|
|
@echo C_SRCS = $(C_SRCS)
|
|
@echo CPP_SRCS = $(CPP_SRCS)
|
|
@echo C_OBJS_EXT = $(C_OBJS_EXT)
|
|
@echo C_DEPS_EXT = $(C_DEPS_EXT)
|
|
@echo CPP_OBJS_EXT = $(CPP_OBJS_EXT)
|
|
@echo CPP_DEPS_EXT = $(CPP_DEPS_EXT)
|