Commit 0eb62453 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

o Only add '-ldl' to LDFLAGS when compiling on non-FreeBSD platforms, as

  dlopen() and friends are included in libc on FreeBSD.
o Use './controller/block_list.sh' (with explicit "./") because '.' isn't on
  the $PATH by default on FreeBSD.
o Disable joystick block for now on FreeBSD due to lack of use case and
  inspiration to port :)
o Use a compatibility hack so we can use 'sed' with the same command line
on Linux and FreeBSD.
o Use '/usr/local/bin/flex' explicitly on FreeBSD since FreeBSD can have
  both BSD flex and GNU flex installed as 'flex', where the former has
  precendence on the normal $PATH.
parent 440256f4
......@@ -7,11 +7,16 @@ CFLAGS= -Wall -O3 \
-I../common/trace \
-I../common/include \
-Idt_azimuth -Idt_elevation -Iec -Ishell -Ilog
LDFLAGS= -lpthread -lrt -lm -ldl -Wl,-E -L../common/lib -L./lib
LDFLAGS= -lpthread -lrt -lm -Wl,-E -L../common/lib -L./lib
CFLAGS_SIM=-DUSE_AZ_SIM -DUSE_EL_SIM
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
LDFLAGS+= -ldl
endif
dt_ctrl_LDFLAGS=`controller/block_list.sh lib/*.a` \
dt_ctrl_LDFLAGS=`./controller/block_list.sh lib/*.a` \
-lcontroller -lethercat -llog -lshell -ldt_azimuth -ldt_elevation
all: dt_ctrl \
......
......@@ -8,6 +8,13 @@ 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 $<
......@@ -22,7 +29,11 @@ LIBTOOL=libtool
%.lo: %.c
@echo "LT CC $<"
@${LIBTOOL} --quiet --mode=compile --tag=CC $(CC) -MMD $(CFLAGS) -c $<
@sed -i -e "s:\.libs/::" -e "s:\.o:\.lo:" .libs/$*.d
# 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
%.la:
@echo "LIBTOOL $@"
......@@ -38,7 +49,8 @@ LIBTOOL=libtool
%.yy.c %.yy.h: %.l %.tab.h
@echo " FLEX $<"
@flex --header-file=$*.yy.h -o $*.yy.c $<
@echo $(FLEX) --header-file=$*.yy.h -o $*.yy.c $<
@$(FLEX) --header-file=$*.yy.h -o $*.yy.c $<
# il2c: instruction list 2 c 'compiler'
%.c %.h: %.il
......
......@@ -14,7 +14,6 @@ BLOCKSRCS= \
block_friction.c \
block_gain.c \
block_gain_var.c \
block_joystick.c \
block_limit.c \
block_limit_dyn.c \
block_limit_2nd.c \
......@@ -43,6 +42,13 @@ BLOCKSRCS= \
block_value_bool.c \
block_value_uint32.c
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
BLOCKSRCS+= \
block_joystick.c
endif
CONTROLLERSRCS= \
controller_block.c \
controller_block_param.c \
......
......@@ -31,6 +31,7 @@ BLOCKSRCS= \
block_beckhoff_el5001.c \
block_beckhoff_el5101.c \
block_beckhoff_el7031.c \
block_beckhoff_ax5xxx.c \
block_stoeber.c
BLOCKS=$(BLOCKSRCS:.c=.lo)
......
CFLAGS= -Wall -g \
-I../controller -I../utils -I../dt_azimuth -I../dt_elevation -I../ec
LDFLAGS= -lpthread -lrt -lm -ldl -lcontroller -lethercat -llog -L../lib
LDFLAGS= -lpthread -lrt -lm -lcontroller -lethercat -llog -L../lib
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
LDFLAGS+= -ldl
endif
all: spg_test iir_test
......
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