Skip to content
Snippets Groups Projects
Commit 59729683 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

put back examples/user_types/Makefile

parent de27517e
No related branches found
No related tags found
No related merge requests found
all:
LCDIR=../..
LCCJAR=${LCDIR}/compiler/labcomm_compiler.jar # the LabComm compiler
LCLJAR=${LCDIR}/lib/java/labcomm.jar # the LabComm library
EXECUTABLES=example_encoder example_decoder Encoder.class Decoder.class Encoder.exe Decoder.exe
include ${LCDIR}/lib/c/os_compat.mk
GENDIR=gen
.PHONY: all cleanbuild clean distclean build run allall buildcs runwcs
all: cleanbuild run
allall: clean build buildcs runwcs
###############################################
### dependencies and parts ####################
###############################################
LCC=java -jar ${LCCJAR}
CLASSPATH=.:${LCLJAR}
${LCCJAR} :
$MAKE -C ${LCDIR} make-compiler
${LCLJAR} :
$MAKE -C ${LCDIR} labcomm.jar
cleanbuild: clean build
labcomm.dll:
ln -sf ../../lib/csharp/labcomm.dll $@
Encoder.exe: Encoder.cs gen/test.cs labcomm.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm
chmod a+x $@
Decoder.exe: Decoder.cs gen/test.cs labcomm.dll Makefile
mcs -out:$@ $(filter %.cs, $^) -lib:../../lib/csharp/ -r:labcomm
chmod a+x $@
build :
mkdir -p ${GENDIR}
java -jar ${LCDIR}/compiler/labcomm_compiler.jar --java=${GENDIR} --c=${GENDIR}/test.c --h=${GENDIR}/test.h --python=${GENDIR}/test.py --cs=${GENDIR}/test.cs test.lc
javac -cp ${LCDIR}/lib/java/labcomm.jar:. ${GENDIR}/*.java Encoder.java Decoder.java
${CC} ${CFLAGS} ${LDFLAGS} -Wall -Werror -Wno-unused-function \
-I. -I${LCDIR}/lib/c -L${LCDIR}/lib/c \
-o example_encoder example_encoder.c ${GENDIR}/test.c \
-llabcomm2014
${CC} ${CFLAGS} ${LDFLAGS} -Wall -Werror -I . -I ${LCDIR}/lib/c -L${LCDIR}/lib/c \
-o example_decoder example_decoder.c ${GENDIR}/test.c \
-llabcomm2014
buildcs: Encoder.exe Decoder.exe
run:
export LD_LIBRARY_PATH=${LCDIR}/lib/c/
@echo
@echo "********************************************"
@echo "*** ************ running example for version 2014 ***"
@echo "********************************************"
@echo
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Encoder encoded_data_j
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_j
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_j
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_j LabComm2014
@echo "************ running C encoder: *****************"
@./example_encoder encoded_data_c
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_c
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_c
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
@echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_p
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_p
@echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
runwcs: Encoder.exe Decoder.exe
export LD_LIBRARY_PATH=${LCDIR}/lib/c/
@echo
@echo "********************************************"
@echo "*** ************ running example for version 2014 ***"
@echo "********************************************"
@echo
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Encoder encoded_data_j
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_j
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_j
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_j LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_j
@echo "************ running C encoder: *****************"
@./example_encoder encoded_data_c
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_c
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_c
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_c
@echo "************ running python encoder: *****************"
@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_p
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_p
@echo "************ running python decoder (from wiki_example):"
PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_p
@echo "************ running C# encoder: *****************"
@./Encoder.exe encoded_data_cs
@echo "************ running Java decoder: *****************"
@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} Decoder encoded_data_cs
@echo "************ running C decoder: *****************"
@./example_decoder encoded_data_cs
@echo "************ running python decoder (from wiki_example):"
@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_cs LabComm2014
@echo "************ running C# decoder: *****************"
@./Decoder.exe encoded_data_cs
clean:
rm -rf ${GENDIR}
distclean:
rm -rf gen
rm -f encoded_data
distclean: clean
rm -f ${EXECUTABLES}
### Example compile script, showing the steps required to build a labcomm application
### (including compiler and libs).
# For current version (2013)
(cd ../..; make all)
mkdir -p gen
java -jar ../../compiler/labcomm_compiler.jar --java=gen --c=gen/test.c --h=gen/test.h --python=gen/test.py test.lc
javac -cp ../../lib/java/labcomm2014.jar:. gen/*.java Encoder.java Decoder.java
# for macOS, add -DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
gcc -Wall -Werror -Wno-unused-function \
-I. -I../../lib/c -L../../lib/c \
-o example_encoder example_encoder.c gen/test.c \
-llabcomm2014
gcc -Wall -Werror -I . -I ../../lib/c -L../../lib/c \
-o example_decoder example_decoder.c gen/test.c \
-llabcomm2014
#-Tlabcomm.linkscript
export LD_LIBRARY_PATH=../../lib/c/
echo
echo "********************************************"
echo "*** Running example for version 2013 ***"
echo "********************************************"
echo
java -cp .:../../lib/java/labcomm2014.jar:gen Encoder encoded_data
echo "running Java decoder:"
java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data
echo "running C decoder:"
./example_decoder encoded_data
echo "running python decoder (from wiki_example):"
PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2014
echo "running C encoder:"
./example_encoder encoded_data
echo "running Java decoder:"
java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data
echo "running C decoder:"
./example_decoder encoded_data
echo "running python decoder (from wiki_example):"
PYTHONPATH=../../lib/python ../wiki_example/example_decoder.py encoded_data LabComm2014
echo "running python encoder:"
PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data2
echo "running Java decoder:"
java -cp .:../../lib/java/labcomm2014.jar:gen Decoder encoded_data2
echo "running C decoder:"
./example_decoder encoded_data2
## Macros
UNAME_S=$(shell uname -s)
ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm2014.a liblabcomm2014.so.1
include os_compat.mk
ifeq ($(UNAME_S),Linux)
CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest -I2006
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
LDFLAGS=-L.
LDLIBS=-llabcomm -llabcomm2006 -lrt
MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
else ifeq ($(UNAME_S),Darwin)
CC=$(CROSS_COMPILE)clang
LD=$(CROSS_COMPILE)ld
CFLAGS=-g -Wall -Werror -O3 -I. -Itest \
-DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
-Wno-tautological-compare -Wno-unused-function
LDFLAGS=-L.
LDLIBS=-llabcomm -llabcomm2006
MAKESHARED=clang -o $1 -shared -Wl,-install_name,$2 $3 -lc
else ifneq ($(findstring CYGWIN,$(UNAME_S)),)
CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
LDFLAGS=-L.
LDLIBS=-llabcomm -lrt
ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # No -fPIC supported in windows?
else
$(error Unknown system $(UNAME_S))
endif
ALL_DEPS=liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm2014.a liblabcomm2014.so.1
ifeq ($(CROSS_COMPILE),i586-wrs-vxworks-)
ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # PIC is only supported for RTPs
CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\"
endif
# TODO: Support for Codesourcery ARM toolchain.
OBJS2006=2006/labcomm2006_memory.o \
......
## Macros
UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest -I2006
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
LDFLAGS=-L.
LDLIBS=-llabcomm -llabcomm2006 -lrt
MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
else ifeq ($(UNAME_S),Darwin)
CC=$(CROSS_COMPILE)clang
LD=$(CROSS_COMPILE)ld
CFLAGS=-g -Wall -Werror -O3 -I. -Itest \
-DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
-Wno-tautological-compare -Wno-unused-function
LDFLAGS=-L.
LDLIBS=-llabcomm -llabcomm2006
MAKESHARED=clang -o $1 -shared -Wl,-install_name,$2 $3 -lc
else ifneq ($(findstring CYGWIN,$(UNAME_S)),)
CFLAGS=-std=c99 -g -Wall -Werror -O3 -I. -Itest
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
LDFLAGS=-L.
LDLIBS=-llabcomm -lrt
ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # No -fPIC supported in windows?
else
$(error Unknown system $(UNAME_S))
endif
ifeq ($(CROSS_COMPILE),i586-wrs-vxworks-)
ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) # PIC is only supported for RTPs
CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\"
endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment