Commit b3c10303 authored by Benoit Rat's avatar Benoit Rat

make: try to add EPICS Makefile system (NOT WORKING)

parent cf571844
......@@ -60,7 +60,7 @@ configure/
doc/html
doc/latex
doc/man
*.depends
......
#Makefile at top of application tree
TOP = .
include $(TOP)/configure/CONFIG
DIRS += configure
DIRS += src
src_DEPEND_DIRS = configure
include $(TOP)/configure/RULES_TOP
# CONFIG
include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
endif
CONFIG=$(EPICS_BASE)/configure
include $(CONFIG)/CONFIG
# Override for definition in base
INSTALL_LOCATION = $(TOP)
include $(TOP)/configure/CONFIG_SITE
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
-include $(TOP)/configure/O.$(T_A)/CONFIG_APP_INCLUDE
endif
# CONFIG_SITE - site-specific build configuration settings
# To restrict the architectures to cross-compile for, set this:
#CROSS_COMPILER_TARGET_ARCHS = arm-linux-gnueabi
# To install somewhere other than $(TOP) set this:
#INSTALL_LOCATION_APP = <install path>
#Makefile
TOP=..
include $(TOP)/configure/CONFIG
# Set the following to NO to disable consistency checking of
# the support applications defined in $(TOP)/configure/RELEASE
CHECK_RELEASE = YES
TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
include $(TOP)/configure/RULES
# EPICS Support
SUPPORT=/opt/EPICS
# EPICS BASE
EPICS_BASE=$(SUPPORT)/base
# asynchronous driver
ASYN=$(SUPPORT)/asyn
##### Bridges
# Set the route of X1052/Jungo
X1052 = /usr/local/include/x1052
JUNGOWDVER=1010
JUNGOWD = /opt/windriver/${JUNGOWDVER}
# Set the route of etherbone
ETHB = /usr/local/include/
#CONFIG
include $(EPICS_BASE)/configure/RULES
# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile
#RULES_DIRS
include $(EPICS_BASE)/configure/RULES_DIRS
#RULES_TOP
include $(EPICS_BASE)/configure/RULES_TOP
......@@ -14,8 +14,10 @@
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
########################################################################
TOP = ..
include $(TOP)/configure/CONFIG
## Cross Compile
### Cross Compile
CC = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
......@@ -23,48 +25,91 @@ OBJDUMP = $(CROSS_COMPILE)objdump
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
## Config
-include $(CURDIR)/.config
## Obtain the version ($ is replaced by $$)
### Obtain the version ($ is replaced by $$)
VERSION = $(shell git describe --always --dirty=+ | sed 's;^.*-\([v0-9\.]*\)\([a-z0-9\-+]*\)$$;\1\2;' )
DATE = $(shell date +"%d %b. %Y")
## Flags
INCLUDE_DIR=-Iewbcore/ -Iewbdrige/ -Iasynwb
CXXFLAGS=-Wall -g -O3 -DTRACE_STDERR -std=c++11
## File processing
ODIR=output/
### Create the user FLAGS
#USR_CFLAGS += -DDEBUG
CXXFLAGS=-Wall -g -DTRACE_STDERR -std=c++11
USR_CXXFLAGS +=${USR_FLAGS}
USR_CXXFLAGS +=${CXXFLAGS}
USR_CXXFLAGS +=-D__GIT_VER__="\"${GIT_VER}\""
SRC_MAIN=$(wildcard ewbcore/*.cpp)
OBJ_MAIN=$(addprefix $(ODIR), $(SRC_MAIN:.cpp=.o))
EWB = $(TOP)/src
all: main
### Define the library
LIBRARY = ewb
ewb_LIBS += $(EPICS_BASE_IOC_LIBS)
ewb_LIBS += asyn
ODIR_%: $(ODIR)$(subst ODIR_,,$@)
mkdir -p $(ODIR)$(subst ODIR_,,$@)
@echo ""
@echo ":==================================================================================================================>"
@echo ""
main: ODIR_ewbcore $(ODIR)libewbmain.a
@echo "----> libewbmain.a OK"
output/libewbmain.a: $(OBJ_MAIN)
$(AR) rc $@ $^ $(LDFLAGS)
bridge:
### Process ewb_core
CORE_SRC_DIR = $(EWB)/ewbcore
CORE_INC +=$(wildcard $(CORE_SRC_DIR)/*.h)
CORE_SRCS +=$(wildcard $(CORE_SRC_DIR)/*.cpp)
CORE_OBJS += $(addprefix $(ODIR), $(subst $(EWB)/,,$(CORE_SRCS:.cpp=.o)))
### Process ewb_bridge
BRIDGE_SRC_DIR = $(EWB)/ewbbridge
BRIDGE_INC +=$(BRIDGE_SRC_DIR)/EWBBridge.h
BRIDGE_INC +=$(BRIDGE_SRC_DIR)/EWBMemTestFileCon.h
BRIDGE_SRCS +=$(BRIDGE_SRC_DIR)/EWBMemTestFileCon.cpp
### Add external library for bridge
ifeq (${JUNGOWD_OFF},1)
USR_CXXFLAGS +=-DAWBPD_NO_X1052
else
BRIDGE_INC +=$(BRIDGE_SRC_DIR)/EWBMemTestFileCon.h
BRIDGE_SRCS +=$(BRIDGE_SRC_DIR)/EWBMemTestFileCon.cpp
USR_INCLUDES +=-I${JUNGOWD} -I${JUNGOWD}/include
USR_INCLUDES +=-I${X1052} -I${X1052}/include
USR_SYS_LIBS += x1052_api
USR_SYS_LIBS += wdapi${JUNGOWDVER}
endif
asynwb:
### Append to the list
SRC_DIRS += $(CORE_SRC_DIR)
INC += $(CORE_INC)
ewb_SRCS += $(CORE_SRCS)
SRC_DIRS += $(BRIDGE_SRC_DIR)
INC += $(BRIDGE_INC)
ewb_SRCS += $(BRIDGE_SRCS)
LIBSRCS = $(ewb_SRCS) #Just to try
### Set to build
include $(TOP)/configure/RULES
###------------------------------------------------
### Custom compilation to test without EPICS
ODIR=output/
test:
@echo "$(INC)"
core: $(ODIR)ewbcore $(ODIR)libewbcore.a
@echo "----> libewbcore.a OK"
output/libewbcore.a: $(CORE_OBJS)
$(AR) rc $@ $^ $(LDFLAGS)
output/%.o: %.cpp
${CC} $(CXXFLAGS) $(INCLUDE_DIR) $(LIB_DIR) -c $*.cpp -o $@
## Directories
$(ODIR)ewbcore:
mkdir -p $(ODIR)ewbcore
$(ODIR)ewbbridge:
mkdir -p $(ODIR)ewbbridge
clean_%:
rm -Rvf $(ODIR)$(subst clean_,,$@)
clean: clean_ewbcore
mrproper: clean_ewbcore
......@@ -56,10 +56,10 @@ GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
all: ewb_test
main: ../src/output/libewbmain.a $(TESTS_MAIN)
main: ../src/output/libewbcore.a $(TESTS_MAIN)
../src/output/libewbmain.a:
../src/output/libewbcore.a:
make -C $(ODIR)
......@@ -87,7 +87,7 @@ gtest_main.a : gtest-all.o gtest_main.o
${CC} $(CPPFLAGS) $(CXXFLAGS) $(INCLUDE_DIR) -c $*.cpp -o $@
#Final app
ewb_test: ewb_test.o EWBFakeWRConsole.o $(OBJ_MAIN) ../src/output/libewbmain.a gtest_main.a
ewb_test: ewb_test.o EWBFakeWRConsole.o $(OBJ_MAIN) ../src/output/libewbcore.a gtest_main.a
${CC} $(CPPFLAGS) $(CXXFLAGS) $(LFLAGS) $^ -o $@
clean:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment