Now, it is not necessary to write different Makefiles for POSIX target.
all: helloworld
-include $(makefile_inc_dir)/../../build/Makefile.arm.inc
+include $(makefile_inc_dir)/../../build/Makefile.rules
vpath %.c $(makefile_inc_dir)
helloworld: main.c $(RPP_LIB_DIR)/rpp-lib.lib
all: rpp-test-suite
-include $(makefile_inc_dir)/../../build/Makefile.arm.inc
+include $(makefile_inc_dir)/../../build/Makefile.rules
SOURCES = main.c sci.c ain.c can.c $(SOURCES_$(TARGET))
SOURCES_posix = eth.c fr.c lin.c
include ../Makefile.config
include $(makefile_lib_inc_dir)/../Makefile.var
-include $(makefile_lib_inc_dir)/Makefile.arm.inc
+include $(makefile_lib_inc_dir)/Makefile.rules
rpp_lib_c_OBJS = $(addsuffix .obj,$(basename $(filter %.c, $(rpp_lib_SOURCES))))
rpp_lib_asm_OBJS = $(addsuffix .obj,$(basename $(filter %.asm, $(rpp_lib_SOURCES))))
-include $(rpp_lib_OBJS:%.obj=%.dep)
$(rpp_lib_c_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.c
- $(call mkdir,$(dir $@))
- $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) $<
+ $(rpp_c_obj_cmds)
$(rpp_lib_asm_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.asm
- $(call mkdir,$(dir $@))
- $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) $<
+ $(rpp_c_obj_cmds)
.PHONY: all clean $(makefile_lib_inc_dir)/../rpp-lib.lib
--- /dev/null
+# Copyright (C) 2013-2015 Czech Technical University in Prague
+#
+# Authors:
+# - Michal Sojka <sojkam1@fel.cvut.cz>
+#
+# This document contains proprietary information belonging to Czech
+# Technical University in Prague. Passing on and copying of this
+# document, and communication of its contents is not permitted
+# without prior written authorization.
+#
+# File : Makefile.rules.arm
+#
+# This file is meant to be included by other Makefiles to gain
+# "platform independent" compilation for RPP.
+
+ifeq ($(TARGET),)
+$(error "Makefile.config must be included before this file")
+endif
+
+makefile_rules_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+
+ifeq ($(TARGET),posix)
+include $(makefile_rules_dir)/Makefile.rules.posix
+else
+include $(makefile_rules_dir)/Makefile.rules.arm
+endif
# document, and communication of its contents is not permitted
# without prior written authorization.
#
-# File : Makefile.arm.rules
+# File : Makefile.rules.arm
#
-# This file is meant to be included by Makefiles in build directories
-# for ARM platforms.
+# This file contains variables and rules specific for compilation for
+# ARM platforms.
-makefile_arm_inc_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+makefile_rules_arm_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(TARGET_CFLAGS),)
$(error "Makefile.config must be included before this file")
$(error $(msg))
endif
-include $(makefile_arm_inc_dir)/../common.mk
+include $(makefile_rules_arm_dir)/../common.mk
CC=$(ARM_COMPILER_DIR)/bin/armcl
AR=$(ARM_COMPILER_DIR)/bin/armar
LD=$(CC)
# Include definition of $(rpp_lib_INCLUDES)
-include $(makefile_arm_inc_dir)/../Makefile.var
+include $(makefile_rules_arm_dir)/../Makefile.var
RPP_CFLAGS = $(TARGET_CFLAGS) --gcc -I$(ARM_COMPILER_DIR)/include \
- $(rpp_lib_INCLUDES:%=-I$(makefile_arm_inc_dir)/../%) \
+ $(rpp_lib_INCLUDES:%=-I$(makefile_rules_arm_dir)/../%) \
--diag_warning=225 --display_error_number --diag_wrap=off \
--gen_func_subsections=on --enum_type=packed
endef
BUILD_DIR ?= Debug
-RPP_LIB_DIR = $(makefile_arm_inc_dir)/$(TARGET)/$(BUILD_DIR)
+RPP_LIB_DIR = $(makefile_rules_arm_dir)/$(TARGET)/$(BUILD_DIR)
RPP_LDFLAGS = \
--run_linker -m"${@:%=%.map}" $(TARGET_LDFLAGS) --diag_wrap=on \
--- /dev/null
+# Copyright (C) 2013-2015 Czech Technical University in Prague
+#
+# Authors:
+# - Michal Sojka <sojkam1@fel.cvut.cz>
+#
+# This document contains proprietary information belonging to Czech
+# Technical University in Prague. Passing on and copying of this
+# document, and communication of its contents is not permitted
+# without prior written authorization.
+#
+# File : Makefile.rules.posix
+#
+# This file contains variables and rules specific for compilation for
+# POSIX platform.
+
+makefile_rules_posix_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+
+ifeq ($(TARGET_CFLAGS),)
+$(error "Makefile.config must be included before this file")
+endif
+
+include $(makefile_rules_posix_dir)/../common.mk
+
+CC=gcc
+AR=ar
+LD=$(CC)
+
+# Include definition of $(rpp_lib_INCLUDES)
+include $(makefile_rules_posix_dir)/../Makefile.var
+
+RPP_CFLAGS = -c $(rpp_lib_INCLUDES:%=-I$(makefile_rules_posix_dir)/../%) $(TARGET_CFLAGS)
+
+RPP_MAKE_CFLAGS = \
+ -MD -MF $@.dep -MP -MT $@
+
+define rpp_c_obj_cmds
+ $(call mkdir,$(dir $@))
+ $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) -o $@ $<
+endef
+
+BUILD_DIR ?= Debug
+RPP_LIB_DIR = $(makefile_rules_posix_dir1)/$(TARGET)/$(BUILD_DIR)
+
+RPP_LDFLAGS =
+
+RPP_LDLIBS = -l$(RPP_LIB_DIR)/rpp-lib.lib $(TARGET_LDLIBS)
+
+$(RPP_LIB_DIR)/rpp-lib.lib:
+ $(MAKE) -C $(dir $@)
--- /dev/null
+include ../../Makefile.lib.inc
+
+RPP_CFLAGS += -g -O0
+++ /dev/null
-include Makefile.config
-include ../../Makefile.var
-
-rpp_lib_CFLAGS = -Wall -g -O0 -I../../apps/rpp-lib_posix/include $(rpp_lib_INCLUDES:%=-I../../%)
-
-rpp_lib_MAKE_CFLAGS = -c -MT $@ -MD -MP -MF "$@.d"
-
-rpp_lib_c_OBJS = $(addsuffix .o,$(basename $(filter %.c, $(rpp_lib_SOURCES))))
-rpp_lib_asm_OBJS = $(addsuffix .o,$(basename $(filter %.asm, $(rpp_lib_SOURCES))))
-rpp_lib_OBJS = $(rpp_lib_c_OBJS) $(rpp_lib_asm_OBJS)
-rpp_lib_DEPS = $(rpp_lib_OBJS:%.o=%.d)
-
-all:: rpp-lib.a
-
-rpp-lib.a: $(rpp_lib_OBJS) #../../rpp/TMS570LS313xFlashLnk.cmd
- $(AR) r $@ $^
-
--include $(rpp_lib_OBJS:%.o=%.d)
-
-$(rpp_lib_c_OBJS): %.o: ../../%.c
- @mkdir -p $(dir $@)
- $(CC) $(rpp_lib_CFLAGS) $(rpp_lib_MAKE_CFLAGS) -o $@ $<
-
-$(rpp_lib_asm_OBJS): %.o: ../../%.asm
- @mkdir -p $(dir $@)
- $(CC) $(rpp_lib_CFLAGS) $(rpp_lib_MAKE_CFLAGS) -o $@ $<
-
-.PHONY: all clean ../../rpp-lib.a
-
-clean::
- rm -rf $(rpp_lib_OBJS) $(rpp_lib_DEPS) rpp-lib.a
--- /dev/null
+include ../../Makefile.lib.inc
+
+RPP_CFLAGS += -O2