# It detect if networking functions have to be compiled # With the generated code. all: build-node all-with-tweak: $(MAKE) all ENABLE_DYNAMIC_CONFIGURATION=1 include $(RUNTIME_PATH)/make/Makefile.$(TARGET) -include ../../userdefined.mk build-node: compile-c-files compile-ada-files compile-node ################################################################################ # Configuration # # In userdefined.mk, we defined the following variables # - USER_CFLAGS : Additional flags to compile .c files # - USER_CPPFLAGS : Additional flags to compile .cpp files # - USER_CC : User overrides CC compiler # - USER_CPP : User ovverides CPP compiler ifneq ($(USER_CC),) CC=$(USER_CC) endif ifneq ($(USER_CPP),) CPP=$(USER_CPP) endif ifneq ($(USER_LD),) LD=$(USER_LD) endif GCC=$(CC) CFLAGS=-Wall $(USER_CFLAGS) $(TARGET_CFLAGS) CPPFLAGS=$(CFLAGS) $(USER_CPPFLAGS) LDFLAGS=$(TARGET_LDFLAGS) $(USER_LDFLAGS) ifdef USE_GPROF CFLAGS+=-D__PO_HI_USE_GPROF -pg endif ifeq ($(ENABLE_DYNAMIC_CONFIGURATION),1) CFLAGS+=-D__PO_HI_USE_DYNAMIC_CONFIGURATION endif ifdef TARGET_INCLUDE INCLUDE=-I. -I$(RUNTIME_PATH)/include/ $(TARGET_INCLUDE) else INCLUDE=-I. -I$(RUNTIME_PATH)/include/ endif ifdef USER_SOURCES_DIRS INCLUDE+=-I$(USER_SOURCES_DIRS) endif INCLUDE+=$(USER_INCLUDE) ifndef $(TARGET_NAME) TARGET_NAME=$(TARGET) endif INCLUDE+=-DTARGET=$(TARGET_NAME) ################################################################################ # Files to be compiled ifeq ($(NEED_TRANSPORT), yes) PO_HI_OBJS = \ po_hi_task.o \ po_hi_time.o \ po_hi_protected.o \ po_hi_main.o \ po_hi_messages.o \ po_hi_marshallers.o \ po_hi_giop.o \ po_hi_utils.o \ po_hi_types.o \ po_hi_gqueue.o \ drivers/po_hi_driver_linux_serial.o \ drivers/po_hi_driver_sockets.o \ drivers/po_hi_driver_sockets_common.o \ drivers/po_hi_driver_sockets_asn1.o \ drivers/po_hi_driver_rasta_serial.o \ drivers/po_hi_driver_rasta_1553.o \ drivers/po_hi_driver_rasta_1553_brmlib.o \ drivers/po_hi_driver_rasta_spacewire.o \ $(ACTUAL_TRANSPORT) \ po_hi_transport.o $(TARGET_TRANSPORT_SOURCES) GENERATED_OBJS = \ activity.o \ subprograms.o \ types.o \ request.o \ deployment.o \ marshallers.o \ naming.o \ main.o else PO_HI_OBJS = \ po_hi_task.o \ po_hi_time.o \ po_hi_utils.o \ po_hi_protected.o \ po_hi_main.o GENERATED_OBJS = \ activity.o \ subprograms.o \ types.o \ main.o endif ifdef USE_ASN1_DEPLOYMENT generate-asn1-deployment: asn1scc.exe ../asn1_deployment.asn1 GENERATED_OBJS += real.o asn1_deployment.o asn1crt.o LDFLAGS += -lm else generate-asn1-deployment: endif ################################################################################ # Simulink ifdef SIMULINK_NODE PO_HI_OBJS += po_hi_simulink.o endif ifdef SIMULINK_DIR INCLUDE += -I$(SIMULINK_DIR) \ -I$(SIMULINK_DIRECTORY)/simulink/include \ -I$(SIMULINK_DIRECTORY)/extern/include \ -I$(SIMULINK_DIRECTORY)/rtw/c/src \ -I$(SIMULINK_DIRECTORY)/rtw/c/src/ext_mode/common \ -I$(SIMULINK_DIRECTORY)/rtw/c/libsrc CFLAGS += -DRT -DUSE_RTMODEL -DMODEL=$(SIMULINK_NODE) -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=0 -DUNIX -DMT=0 -DHAVESTDIO LDFLAGS += $(SIMULINK_LDFLAGS) endif ################################################################################ # SCADE ifdef SCADE_DIR INCLUDE += -I$(SCADE_DIR) USER_OBJS += $(SCADE_DIR)/*.o endif ################################################################################ # General RTEMS STUFF check-rtems: if [ ! -d $$RTEMS_MAKEFILE_PATH/make ]; then \ echo "Please define the RTEMS_MAKEFILE_PATH variable" && exit 2 ; \ fi ################################################################################ # General compilation rules compile-po-hi: ifdef SIMULINK_DIR (cd $(SIMULINK_DIR) && $(MAKE) -f $(SIMULINK_NODE).mk && rm -f grt_main.o) endif ifdef SCADE_DIR (cd $(SCADE_DIR) && for v in `ls *.c`; do $(CC) -c $$v; done) endif for f in $(PO_HI_OBJS); do \ c_file="`basename $$f .o`.c"; \ c_file_dirname="`dirname $$f`"; \ if [ -n "$$c_file_dirname" ]; then \ if [ ! -d $$c_file_dirname ]; then mkdir -p $$c_file_dirname ; fi ; \ $(CC) $(INCLUDE) $(CFLAGS) -c -o $$f '$(RUNTIME_PATH)/src/'$$c_file_dirname'/'$$c_file || exit 1 ; \ else \ $(CC) $(INCLUDE) $(CFLAGS) -c -o $$f '$(RUNTIME_PATH)/src/'$$c_file || exit 1 ; \ fi ; \ done compile-node: $(BINARY) ifeq ($(TARGET), leon.rtems) OBJS = $(USER_OBJS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(EXTERNAL_OBJECTS) $(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(USER_OBJS) $(GENERATED_OBJS) $(make-exe) else $(BINARY): generate-asn1-deployment target-objects compile-po-hi $(USER_OBJS) $(GENERATED_OBJS) $(TARGET_OBJECTS) $(CC) -o $(BINARY) $(EXTERNAL_OBJECTS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(USER_OBJS) $(LDFLAGS) endif %.o: %.cpp $(CPP) $(INCLUDE) $(CPPFLAGS) -c -o $@ $< %.o: %.c $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< clean: target-clean @-rm -f *~ *.o *.al temp.* *.metrix $(BINARY) $(BINARY).bin $(BINARY).bt $(BINARY).num $(BINARY).nxe @-rm -rf drivers if test ! "$(CLEANDIRS)" = ""; then \ rm -rf $(CLEANDIRS); \ fi ifdef USE_GPROF gprof: ./$(BINARY) gprof ./$(BINARY) > gprof.out endif