Commit 4b8f214d authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

move controller to new build

parent 56d8add4
......@@ -21,9 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include "block_switch.h"
#include <controller/controller_block.h>
/*
inputs outputs
......
......@@ -21,10 +21,10 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include "controller_sample.h"
#include "block_trajectplayer.h"
#include "log.h"
#include <controller/controller_block.h>
#include <controller/controller_sample.h>
#include <block/block_trajectplayer.h>
#include <log/log.h>
/*
inputs outputs
......
......@@ -19,7 +19,7 @@
#ifndef _INCLUDE_BLOCK_TRAJECTPLAYER_
#define _INCLUDE_BLOCK_TRAJECTPLAYER_
#include "controller_block.h"
#include <controller/controller_block.h>
struct controller_block * block_trajectplayer_create(char *name);
......
......@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include <controller/controller_block.h>
/*
inputs outputs
......
......@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include <controller/controller_block.h>
/*
outputs
......
......@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include <controller/controller_block.h>
/*
outputs
......
......@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include <controller/controller_block.h>
/*
outputs
......
BLOCK_TARGETS += $(LIBDIR)/libblock.la
$(eval $(call SUBDIR,il2c))
BLOCK_SRCS = \
$(DIR)/block_add.c \
$(DIR)/block_and2.il \
$(DIR)/block_bridge_pwm.c \
$(DIR)/block_counter.c \
$(DIR)/block_debug.c \
$(DIR)/block_decoder_uint32_bool.c \
$(DIR)/block_filter_iir.c \
$(DIR)/block_filter_lp.c \
$(DIR)/block_friction.c \
$(DIR)/block_gain.c \
$(DIR)/block_gain_var.c \
$(DIR)/block_limit.c \
$(DIR)/block_limit_dyn.c \
$(DIR)/block_limit_2nd.c \
$(DIR)/block_limit_var.c \
$(DIR)/block_matrix_2x2.c \
$(DIR)/block_multiplexer.c \
$(DIR)/block_not.il \
$(DIR)/block_or2.il \
$(DIR)/block_or3.il \
$(DIR)/block_or4.il \
$(DIR)/block_pid.c \
$(DIR)/block_pid_aw.c \
$(DIR)/block_quadrature_decoder.c \
$(DIR)/block_quantize.c \
$(DIR)/block_random.c \
$(DIR)/block_rangecheck.c \
$(DIR)/block_register.il \
$(DIR)/block_setpoint_generator.c \
$(DIR)/block_setreset.il \
$(DIR)/block_servo_state.c \
$(DIR)/block_sine.c \
$(DIR)/block_subtract.c \
$(DIR)/block_switch.c \
$(DIR)/block_trajectplayer.c \
$(DIR)/block_trigger.c \
$(DIR)/block_value.c \
$(DIR)/block_value_bool.c \
$(DIR)/block_value_uint32.c
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
BLOCK_SRCS+= \
$(DIR)/block_joystick.c
endif
BLOCK_OBJSC := $(BLOCK_SRCS:.c=.lo)
BLOCK_OBJS := $(BLOCK_OBJSC:.il=.il2c.lo)
$(LIBDIR)/libblock.la: LDFLAGS += -lm
$(LIBDIR)/libblock.la: CFLAGS += -O3 -Wall
$(LIBDIR)/libblock.la: $(BLOCK_OBJS)
$(LIB_LINK)
TARGETS += $(BLOCK_TARGETS)
CLEAN += $(BLOCK_TARGETS) $(BLOCK_OBJS)
SRCS += $(BLOCK_SRCS)
CFLAGS+= -O3 -Wall
all: il2c test
il2c: il.tab.o il.yy.o il2c.o
il2c.o: il.tab.h
test: il2c
@echo " SUBDIR: $@"
@$(MAKE) -C test
SRCS= il2c.c
clean:
rm -f il2c *.o *.tab.c *.tab.h *.yy.c *.d *.lo
@$(MAKE) -C test clean
include ../../build.mk
IL2C:=$(DIR)/il2c
$(eval $(call SUBDIR,test))
IL2C_TARGETS += $(DIR)/il2c
#$(eval $(call SUBDIR,test))
IL2C_SRCS = \
$(DIR)/il.tab.c \
$(DIR)/il.yy.c \
$(DIR)/il2c.c
$(DIR)/il2c.c: $(DIR)/il.tab.h
IL2C_OBJS := $(IL2C_SRCS:.c=.o)
$(DIR)/il2c: CFLAGS += -O3 -Wall
$(DIR)/il2c: $(IL2C_OBJS)
TARGETS += $(IL2C_TARGETS)
CLEAN += $(IL2C_TARGETS) $(IL2C_OBJS)
SRCS += $(IL2C_SRCS)
IL2C=../il2c
CFLAGS=-I ../../../
all: blocks
blocks: noil.o test.o oneshot.o
clean:
rm -rf *.o *.lo *.d *.h
include ../../../build.mk
TEST_TARGETS := $(DIR)/blocks
BLOCKS_SRCS = \
$(DIR)/noil.c \
$(DIR)/test.il \
$(DIR)/oneshot.il
BLOCKS_OBJSC := $(BLOCKS_SRCS:.c=.o)
BLOCKS_OBJS := $(BLOCKS_OBJSC:.il=.il2c.o)
$(DIR)/blocks: CFLAGS += -g -O0
$(DIR)/blocks: $(BLOCKS_OBJS)
TARGETS += $(TEST_TARGETS)
CLEAN += $(TEST_TARGETS) $(BLOCKS_OBJS)
SRCS += $(BLOCKS_SRCS)
# Some make rules to make output pretty....
# default ARFLAGS also has 'v', but we don't want it to be verbose.
ARFLAGS= -r
# make sure libs from /usr/local/lib are found
VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL=libtool
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
FLEX=flex
else
FLEX=/usr/local/bin/flex
endif
%.o : %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) -c $<
%.o : %.il2c.c
@echo "LT CCil $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) -c $<
@sed -e "s:\.il2c.c:\.il:" -i -i $*.il2c.d
# @echo " CC $<"
# @$(CC) -MMD $(CFLAGS) -c $<
%: %.o
@echo " LD $@"
@${LIBTOOL} --quiet --mode=link --tag=CC $(LINK.o) $(filter %.o,$^) $(LOADLIBS) $(LDLIBS) $($@_LDFLAGS) -o $@
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) -c $<
# compatibility hack: Linux's sed doesn't have a separate argument to '-i',
# while on FreeBSD, '-i' takes a non-optional extension argument. With
# '-i -i' we'll specify '-i' twice on Linux and let FreeBSD use '[filename]-i'
# as intermediate file for in-place editing.
@sed -e "s:\.libs/::" -e "s:\.o:\.lo:" -i -i .libs/$*.d
%.lo: %.il2c.c
@echo "LT CCil $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) -c $<
# compatibility hack: Linux's sed doesn't have a separate argument to '-i',
# while on FreeBSD, '-i' takes a non-optional extension argument. With
# '-i -i' we'll specify '-i' twice on Linux and let FreeBSD use '[filename]-i'
# as intermediate file for in-place editing.
@sed -e "s:\.libs/::" -e "s:\.o:\.lo:" -e "s:\.il2c.c:\.il:" -i -i .libs/$*.il2c.d
%.la:
@echo "LIBTOOL $@"
@${LIBTOOL} --quiet --mode=link gcc $^ -o $@ $(LDFLAGS) $($@_LDFLAGS) -static-libtool-libs
(%): %
@echo " AR $^ in $@"
@$(AR) $(ARFLAGS) $@ $^
%.tab.c %.tab.h: %.y
@echo " BISON $<"
@bison -d $<
%.yy.c %.yy.h: %.l %.tab.h
@echo " FLEX $<"
@echo $(FLEX) --header-file=$*.yy.h -o $*.yy.c $<
@$(FLEX) --header-file=$*.yy.h -o $*.yy.c $<
# il2c: instruction list 2 c 'compiler'
%.il2c.c: %.il
@echo " IL2C $<"
@$(IL2C) $<
# dot -> pdf
%.pdf: %.dot
@echo " DOT $<"
@dot $< -o $@ -Tpdf
SRCS_TMP=$(SRCS:.il=.il.d)
-include $(SRCS_TMP:.c=.d) $(patsubst %.c,.libs/%.d,$(SRCS_TMP))
LIBDIR:=$(DIR)/lib
$(eval $(call SUBDIR,controller))
$(eval $(call SUBDIR,shell))
$(eval $(call SUBDIR,block))
$(eval $(call SUBDIR,ec))
$(eval $(call SUBDIR,dt_azimuth))
$(eval $(call SUBDIR,dt_elevation))
$(eval $(call SUBDIR,test))
DT_CTRL_TARGETS += $(DIR)/dt_ctrl
DT_CTRL_SRCS := $(DIR)/dt_ctrl.c
DT_CTRL_OBJS := $(DT_CTRL_SRCS:.c=.o)
BLOCKS := `$(DIR)/controller/block_list.sh $(DIR)/lib/*.a`
$(DIR)/dt_ctrl: \
libcontroller.la \
libblock.la \
libethercat.la \
liblog.la \
libshell.la \
libdt_azimuth.la \
libdt_elevation.la
$(DIR)/dt_ctrl: CFLAGS += -Wall -O3
$(DIR)/dt_ctrl: LDFLAGS += \
-Wl,-E \
-lcontroller \
-lblock \
-lethercat \
-llog \
-lshell \
-ldt_azimuth \
-ldt_elevation \
$(BLOCKS)
$(DIR)/dt_ctrl: $(DT_CTRL_OBJS)
SRCS += $(DT_CTRL_SRCS)
TARGETS += $(DT_CTRL_TARGETS)
CLEAN += $(DT_CTRL_TARGETS) $(DT_CTRL_OBJS)
CFLAGS= -O3 -Wall -I../../common/log/ -I../shell/ -I.. -I../../common/ -I../../common/include
CONTROLLERSRCS= \
controller_block.c \
controller_block_param.c \
controller_block_trace.c \
controller_command.c \
controller_trace.c \
controller_sample.c \
controller_dumpdot.c \
controller_load.c \
controller_load_variable.c \
controller_load_parser.tab.c \
controller_load_parser.yy.c
SRCS= $(CONTROLLERSRCS)
CONTROLLER= $(CONTROLLERSRCS:.c=.lo)
all: libcontroller.la_install
controller_load_parser.tab.lo: controller_load_parser.yy.c
controller_load.lo: controller_load_parser.tab.h controller_load_parser.yy.h
libcontroller.la_LDFLAGS=-rpath ${CURDIR}/../lib -lshell -ldl -lpthread -lrt -lcommand -ltrace -L../../common/lib
libcontroller.la: $(CONTROLLER)
libcontroller.la_install: libcontroller.la
@echo "CP $^ to libdir"
@${LIBTOOL} --quiet --mode=install install libcontroller.la ${CURDIR}/../lib
clean:
rm -rf *.o *.a *.yy.* *.tab.* *.d *.lo *.la .libs
include ../build.mk
CONTROLLER_TARGETS += $(LIBDIR)/libcontroller.la
CONTROLLER_SRCS= \
$(DIR)/controller_block.c \
$(DIR)/controller_block_param.c \
$(DIR)/controller_block_trace.c \
$(DIR)/controller_command.c \
$(DIR)/controller_trace.c \
$(DIR)/controller_sample.c \
$(DIR)/controller_dumpdot.c \
$(DIR)/controller_load.c \
$(DIR)/controller_load_variable.c \
$(DIR)/controller_load_parser.tab.c \
$(DIR)/controller_load_parser.yy.c
CONTROLLER_OBJS := $(CONTROLLER_SRCS:.c=.lo)
$(LIBDIR)/libcontroller.la: libshell.la libcommand.la libtrace.la
$(LIBDIR)/libcontroller.la: LDFLAGS += -lshell -ldl -lpthread -lrt -lcommand -ltrace
$(LIBDIR)/libcontroller.la: CFLAGS += -O3 -Wall
$(LIBDIR)/libcontroller.la: $(CONTROLLER_OBJS)
$(LIB_LINK)
$(DIR)/controller_load_parser.tab.lo: $(DIR)/controller_load_parser.yy.c
$(DIR)/controller_load.lo: $(DIR)/controller_load_parser.tab.h
$(DIR)/controller_load.lo: $(DIR)/controller_load_parser.yy.h
TARGETS += $(CONTROLLER_TARGETS)
CLEAN += $(CONTROLLER_TARGETS) $(CONTROLLER_OBJS)
SRCS += $(CONTROLLER_SRCS)
......@@ -24,9 +24,9 @@
#include <pthread.h>
#include <dlfcn.h>
#include "controller_block.h"
#include "controller_sample.h"
#include "log.h"
#include <controller/controller_block.h>
#include <controller/controller_sample.h>
#include <log/log.h>
int nr_blocks = 0;
static struct controller_block **blocks = NULL;
......
......@@ -27,9 +27,9 @@
#include <string.h>
#include <stdlib.h>
#include "controller_block.h"
#include "controller_sample.h"
#include "log.h"
#include <controller/controller_block.h>
#include <controller/controller_sample.h>
#include <log/log.h>
static pthread_mutex_t param_lock;
static sem_t param_sync_sem;
......
......@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <string.h>
#include "controller_block.h"
#include "log.h"
#include <controller/controller_block.h>
#include <log/log.h>
static int nr_traces = 0;
static struct controller_trace **traces;
......
......@@ -31,8 +31,8 @@
#include <errno.h>
#include <limits.h>
#include "log.h"
#include "dt_port_numbers.h"
#include <log/log.h>
#include <dt_port_numbers.h>
#include <controller/controller_command.h>
#include <controller/controller_sample.h>
......
......@@ -21,15 +21,15 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "controller_load_parser.tab.h"
#include "controller_load_parser.yy.h"
#include "controller_load.h"
#include "controller_load_int.h"
#include "controller_sample.h"
#include "controller_block.h"
#include "../../common/include/dynarg.h"
#include <controller/controller_load_parser.tab.h>
#include <controller/controller_load_parser.yy.h>
#include <controller/controller_load.h>
#include <controller/controller_load_int.h>
#include <controller/controller_sample.h>
#include <controller/controller_block.h>
#include <dynarg.h>
#include <shell/shell.h>
#include "log.h"
#include <log/log.h>
struct controller_load_array {
void *array;
......
Supports Markdown
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