qpc/ports/win32-qv/Makefile

232 lines
6.1 KiB
Makefile
Raw Normal View History

2012-08-14 18:07:04 -04:00
##############################################################################
2019-02-10 21:00:39 -05:00
# Product: Makefile for QP/C port to Win32-QV, MinGW toolset
2020-10-01 12:48:48 -04:00
# Last updated for version 6.9.1
# Last updated on 2020-09-10
2012-08-14 18:07:04 -04:00
#
2018-10-25 11:11:36 -04:00
# Q u a n t u m L e a P s
# ------------------------
# Modern Embedded Software
2012-08-14 18:07:04 -04:00
#
2020-04-02 21:21:11 -04:00
# Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
2012-08-14 18:07:04 -04:00
#
2012-12-10 16:00:27 -05:00
# 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
2012-12-10 16:00:27 -05:00
# (at your option) any later version.
2012-08-14 18:07:04 -04:00
#
2012-12-10 16:00:27 -05:00
# Alternatively, this program may be distributed and modified under the
2012-08-14 18:07:04 -04:00
# terms of Quantum Leaps commercial licenses, which expressly supersede
2012-12-10 16:00:27 -05:00
# 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/>.
2012-08-14 18:07:04 -04:00
#
# Contact information:
2019-12-31 15:55:08 -05:00
# <www.state-machine.com/licensing>
# <info@state-machine.com>
2012-08-14 18:07:04 -04:00
##############################################################################
# examples of invoking this Makefile:
2017-05-27 10:41:37 -04:00
# building configurations: Debug (default), Release and Spy
2015-04-28 13:45:35 -04:00
# make
# make CONF=rel
# make CONF=spy
2012-08-14 18:07:04 -04:00
#
# cleaning configurations: Debug (default), Release, and Spy
2015-04-28 13:45:35 -04:00
# make clean
# make CONF=rel clean
# make CONF=spy 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:
2019-01-14 12:09:45 -05:00
# https://sourceforge.net/projects/qpc/files/QTools/
2012-08-14 18:07:04 -04:00
#
#-----------------------------------------------------------------------------
2018-11-22 11:35:21 -05:00
# project name:
2012-08-14 18:07:04 -04:00
#
2018-11-22 11:35:21 -05:00
PROJECT := qp
2012-08-14 18:07:04 -04:00
#-----------------------------------------------------------------------------
2018-11-22 11:35:21 -05:00
# project directories:
2012-08-14 18:07:04 -04:00
#
2015-04-28 13:45:35 -04:00
# location of the QP/C framework
2015-06-04 22:47:13 -04:00
QPC := ../..
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
# QP port used in this project
2015-06-04 22:47:13 -04:00
QP_PORT_DIR := .
2012-08-14 18:07:04 -04:00
2013-09-23 14:34:35 -04:00
2015-04-28 13:45:35 -04:00
# list of all source directories used by this project
VPATH = \
2017-05-27 10:41:37 -04:00
$(QPC)/src/qf \
2017-06-06 15:13:52 -04:00
$(QPC)/src/qs \
2015-04-28 13:45:35 -04:00
$(QP_PORT_DIR)
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
# list of all include directories needed by this project
INCLUDES = \
-I$(QPC)/include \
2017-05-27 10:41:37 -04:00
-I$(QPC)/src \
2015-04-28 13:45:35 -04:00
-I$(QP_PORT_DIR)
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# files
#
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
# C source files
C_SRCS := \
qep_hsm.c \
qep_msm.c \
qf_act.c \
qf_actq.c \
qf_defer.c \
qf_dyn.c \
qf_mem.c \
qf_ps.c \
qf_qact.c \
qf_qeq.c \
qf_qmact.c \
qf_time.c \
2016-05-05 12:19:00 -04:00
qwin_gui.c \
2015-04-28 13:45:35 -04:00
qf_port.c
C_QS_SRCS := \
qs.c \
2015-09-04 12:08:22 -04:00
qs_rx.c \
2015-04-28 13:45:35 -04:00
qs_fp.c \
2018-10-25 11:11:36 -04:00
qs_64bit.c \
qs_port.c
2015-04-28 13:45:35 -04:00
# C++ source files
CPP_SRCS :=
2018-11-22 11:35:21 -05:00
# defines:
2020-10-01 12:48:48 -04:00
DEFINES := -DQWIN_GUI -DQP_API_VERSION=9999
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# 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/
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
CC := gcc
2016-06-10 21:50:26 -04:00
CPP := g++
2015-04-28 13:45:35 -04:00
LIB := ar
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
##############################################################################
# Typically, you should not need to change anything below this line
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
# basic utilities (included in Qtools for Windows), see:
# http://sourceforge.net/projects/qpc/files/Qtools
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
MKDIR := mkdir
RM := rm
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# build options for various configurations
#
2013-09-23 14:34:35 -04:00
2015-04-28 13:45:35 -04:00
LIBFLAGS := rs
2012-08-14 18:07:04 -04:00
2015-06-04 22:47:13 -04:00
ifeq (rel, $(CONF)) # Release configuration .................................
2012-08-14 18:07:04 -04:00
2017-05-27 10:41:37 -04:00
BIN_DIR := rel
2012-08-14 18:07:04 -04:00
2019-01-14 12:09:45 -05:00
# gcc options:
2020-04-02 21:21:11 -04:00
CFLAGS := -c -O3 -fno-pie -std=c90 -pedantic -Wall -Wextra -W \
2019-02-10 21:00:39 -05:00
$(INCLUDES) $(DEFINES) -DNDEBUG
2012-08-14 18:07:04 -04:00
2019-02-10 21:00:39 -05:00
CPPFLAGS := -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \
-fno-rtti -fno-exceptions \
$(INCLUDES) $(DEFINES) -DNDEBUG
2015-09-04 12:08:22 -04:00
2015-04-28 13:45:35 -04:00
else ifeq (spy, $(CONF)) # Spy configuration ................................
2012-08-14 18:07:04 -04:00
2019-01-14 12:09:45 -05:00
BIN_DIR := spy
2015-09-04 12:08:22 -04:00
2015-04-28 13:45:35 -04:00
# add the QS sources...
C_SRCS += $(C_QS_SRCS)
2012-08-14 18:07:04 -04:00
2019-01-14 12:09:45 -05:00
# gcc options:
2020-04-02 21:21:11 -04:00
CFLAGS := -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \
2019-02-10 21:00:39 -05:00
$(INCLUDES) $(DEFINES) -DQ_SPY
2019-01-14 12:09:45 -05:00
2019-02-10 21:00:39 -05:00
CPPFLAGS := -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \
-fno-rtti -fno-exceptions \
$(INCLUDES) $(DEFINES) -DQ_SPY
2019-01-14 12:09:45 -05:00
else # default Debug configuration .........................................
2012-08-14 18:07:04 -04:00
2019-01-14 12:09:45 -05:00
BIN_DIR := dbg
2012-08-14 18:07:04 -04:00
2019-01-14 12:09:45 -05:00
# gcc options:
2020-04-02 21:21:11 -04:00
CFLAGS := -c -g -O -fno-pie -std=c90 -pedantic -Wall -Wextra -W \
2019-02-10 21:00:39 -05:00
$(INCLUDES) $(DEFINES)
2012-08-14 18:07:04 -04:00
2019-02-10 21:00:39 -05:00
CPPFLAGS := -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \
-fno-rtti -fno-exceptions \
$(INCLUDES) $(DEFINES)
2015-09-04 12:08:22 -04:00
2015-04-28 13:45:35 -04:00
endif
2012-08-14 18:07:04 -04:00
2019-02-10 21:00:39 -05:00
#-----------------------------------------------------------------------------
2015-04-28 13:45:35 -04:00
C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS)))
CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS)))
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
TARGET_LIB := $(BIN_DIR)/lib$(PROJECT).a
C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS))
2019-02-10 21:00:39 -05:00
C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT))
2015-04-28 13:45:35 -04:00
CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS))
2019-02-10 21:00:39 -05:00
CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT))
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
# create $(BIN_DIR) if it does not exist
ifeq ("$(wildcard $(BIN_DIR))","")
$(shell $(MKDIR) $(BIN_DIR))
endif
2013-09-23 14:34:35 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# rules
#
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
all: $(TARGET_LIB)
-$(RM) $(BIN_DIR)/*.o
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
$(TARGET_LIB) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT)
$(LIB) $(LIBFLAGS) $@ $^
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
$(BIN_DIR)/%.o : %.c
2017-05-27 10:41:37 -04:00
$(CC) $(CFLAGS) $< -o $@
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
$(BIN_DIR)/%.o : %.cpp
2017-05-27 10:41:37 -04:00
$(CPP) $(CPPFLAGS) $< -o $@
2012-08-14 18:07:04 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# the clean target
#
2012-08-14 18:07:04 -04:00
.PHONY : clean
clean:
2015-04-28 13:45:35 -04:00
-$(RM) $(BIN_DIR)/*.o $(TARGET_LIB)
2017-05-27 10:41:37 -04:00
2015-04-28 13:45:35 -04:00
#-----------------------------------------------------------------------------
# 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)
2015-09-04 12:08:22 -04:00
@echo CPP_OBJS_EXT = $(CPP_OBJS_EXT)
2015-04-28 13:45:35 -04:00
@echo CPP_DEPS_EXT = $(CPP_DEPS_EXT)