Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
59729683
Commit
59729683
authored
Oct 25, 2014
by
Sven Gestegård Robertz
Browse files
put back examples/user_types/Makefile
parent
de27517e
Changes
5
Hide whitespace changes
Inline
Side-by-side
examples/user_types/Makefile
View file @
59729683
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
:
clean
:
rm
-rf
${GENDIR}
distclean
:
distclean
:
clean
rm
-rf
gen
rm
-f
${EXECUTABLES}
rm
-f
encoded_data
examples/user_types/compile.sh
deleted
100644 → 0
View file @
de27517e
### 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
examples/user_types/run.sh
deleted
100644 → 0
View file @
de27517e
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
lib/c/Makefile
View file @
59729683
## Macros
## Macros
UNAME_S
=
$(
shell
uname
-s
)
include
os_compat.mk
ALL_DEPS
=
liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm2014.a liblabcomm2014.so.1
ifeq
($(UNAME_S),Linux)
ALL_DEPS
=
liblabcomm.a liblabcomm.so.1 liblabcomm2006.a liblabcomm2006.so.1 liblabcomm2014.a liblabcomm2014.so.1
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
# TODO: Support for Codesourcery ARM toolchain.
# TODO: Support for Codesourcery ARM toolchain.
OBJS2006
=
2006/labcomm2006_memory.o
\
OBJS2006
=
2006/labcomm2006_memory.o
\
...
...
lib/c/os_compat.mk
0 → 100644
View file @
59729683
## 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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment