Makefile 6.08 KB
Newer Older
1 2 3 4
LCDIR=../..
LCCJAR=${LCDIR}/compiler/labcomm_compiler.jar  # the LabComm compiler
LCLJAR=${LCDIR}/lib/java/labcomm.jar  # the LabComm library

5
EXECUTABLES=example_encoder example_decoder ExampleEncoder.class Decoder.class Encoder.exe Decoder.exe
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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 

47
	javac -cp ${LCDIR}/lib/java/labcomm.jar:. ${GENDIR}/*.java ExampleEncoder.java Decoder.java
48 49 50 51

	${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 \
52
	    -llabcomm2014 
53 54 55

	${CC} ${CFLAGS} ${LDFLAGS} -Wall -Werror -I . -I ${LCDIR}/lib/c -L${LCDIR}/lib/c \
	    -o example_decoder example_decoder.c ${GENDIR}/test.c \
56
	    -llabcomm2014 
57 58 59 60 61 62 63 64 65 66 67

buildcs: Encoder.exe Decoder.exe

run:
	export LD_LIBRARY_PATH=${LCDIR}/lib/c/
	@echo
	@echo "********************************************"
	@echo "***   ************ running example for version 2014   ***"
	@echo "********************************************"
	@echo

68
	@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} ExampleEncoder encoded_data_j
69 70 71 72 73 74 75 76

	@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):"
77
	@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_j LabComm2014
78 79 80 81 82 83 84 85 86 87 88

	@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):"
89
	@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
90

91
	@echo "************ running python encoder: *****************"
92
	@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
93 94 95 96 97 98 99 100

	@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):"
101
	PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
102 103 104 105 106 107 108 109 110

runwcs: Encoder.exe Decoder.exe
	export LD_LIBRARY_PATH=${LCDIR}/lib/c/
	@echo
	@echo "********************************************"
	@echo "***   ************ running example for version 2014   ***"
	@echo "********************************************"
	@echo

111
	@java -cp .:${LCDIR}/lib/java/labcomm.jar:${GENDIR} ExampleEncoder encoded_data_j
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134

	@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):"
135
	@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_c LabComm2014
136 137 138 139

	@echo "************ running C# decoder: *****************"
	@./Decoder.exe encoded_data_c

140
	@echo "************ running python encoder: *****************"
141
	@PYTHONPATH=${LCDIR}/lib/python:${GENDIR} ./example_encoder.py encoded_data_p LabComm2014
142 143 144 145 146 147 148 149

	@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):"
150
	PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_p LabComm2014
151 152 153 154 155 156 157 158 159 160 161 162 163 164

	@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):"
165
	@PYTHONPATH=${LCDIR}/lib/python ../wiki_example/example_decoder.py encoded_data_cs LabComm2014
166 167 168 169 170

	@echo "************ running C# decoder: *****************"
	@./Decoder.exe encoded_data_cs


171 172

clean:
173
	rm -rf ${GENDIR}
174

175 176
distclean: clean
	rm -f ${EXECUTABLES}