Skip to content

Commit

Permalink
Split makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Géry Casiez committed Aug 15, 2023
1 parent bab1326 commit b239093
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 63 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/testcpp.yml
@@ -0,0 +1,17 @@
name: Test cpp

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: gcc:latest

steps:
- uses: actions/checkout@v3
- name: make
run: cd cpp ; make
15 changes: 15 additions & 0 deletions C/Makefile
@@ -0,0 +1,15 @@
CC=gcc
CFLAGS=-I.
PYTHON=python3

all: testc

SF1eFilter.o:
$(CC) -c -o SF1eFilter.o SF1eFilter.c $(CFLAGS)

c: SF1eFilter.o
$(CC) -o 1eurofilter SF1eFilter.o test.c ; \
./1eurofilter > test.csv

testc: c
$(PYTHON) ../test.py Cversion test.csv
11 changes: 11 additions & 0 deletions CppUsingTemplates/Makefile
@@ -0,0 +1,11 @@
CPP=g++
PYTHON=python3

all: testcplusplusUsingTemplates

cplusplusUsingTemplates:
$(CPP) -o 1efilter 1efilter.cc ; \
./1efilter > test.csv

testcplusplusUsingTemplates: cplusplusUsingTemplates
$(PYTHON) ../test.py cppUsingTemplates test.csv
73 changes: 13 additions & 60 deletions Makefile
@@ -1,76 +1,29 @@
CPP=g++
CC=gcc
CFLAGS=-I.
PYTHON=python3

all: testcplusplus testcplusplusUsingTemplates testc testpython testJava testJavascript testTypescript

# C++ version original
OneEuroFilter.o:
cd cpp ; \
$(CPP) -c -o OneEuroFilter.o OneEuroFilter.cpp

cplusplus: OneEuroFilter.o
cd cpp ; \
$(CPP) -o OneEuroFilterCpp OneEuroFilter.o Test.cpp ; \
./OneEuroFilterCpp > test.csv

testcplusplus: cplusplus
$(PYTHON) test.py cpp cpp/test.csv
testcplusplus:
cd cpp ; make

# C++ version using templates
cplusplusUsingTemplates:
cd CppUsingTemplates ; \
$(CPP) -o 1efilter 1efilter.cc ; \
./1efilter > test.csv

testcplusplusUsingTemplates: cplusplusUsingTemplates
$(PYTHON) test.py cppUsingTemplates CppUsingTemplates/test.csv
testcplusplusUsingTemplates:
cd CppUsingTemplates ; make

# C version
SF1eFilter.o:
cd C ; \
$(CC) -c -o SF1eFilter.o SF1eFilter.c $(CFLAGS)

c: SF1eFilter.o
cd C ; \
$(CC) -o 1eurofilter SF1eFilter.o test.c ; \
./1eurofilter > test.csv

testc: c
$(PYTHON) test.py Cversion C/test.csv
testc:
cd C ; make

# Python version
testpython:
cd python ; \
$(PYTHON) OneEuroFilterTest.py > test.csv ; \
cd .. ; \
$(PYTHON) test.py python python/test.csv
cd python ; make

# Java
javaVersion:
cd java ; \
javac Test.java ; \
java Test > test.csv ; \

testJava: javaVersion
$(PYTHON) test.py java java/test.csv
testJava:
cd java ; make

# Javascript
javascriptVersion:
cd javascript ; \
node test.js > test.csv

testJavascript: javascriptVersion
$(PYTHON) test.py javascript javascript/test.csv
testJavascript:
cd javascript ; make

# Typescript

typeScriptVersion:
cd typescript ; \
npm install ; \
tsc ; \
node dist/test.js > test.csv

testTypescript: typeScriptVersion
$(PYTHON) test.py typescript typescript/test.csv
testTypescript:
cd typescript ; make
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,9 +11,9 @@ See more on the [1€ filter homepage](https://gery.casiez.net/1euro/) for detai

1. [Fork](https://github.com/casiez/OneEuroFilter/fork) the repo.
1. Create a folder with your implementation and add the files for your implementation.
1. Create a file that can be executed to output in a console the result of the filtering for the ground truth. See the existing files as examples.
1. Create a file that can be executed to output in a console the result of the filtering for the ground truth. See the existing files as examples. Create a Makefile to test your implementation (see the other examples).
1. Update [docker/Dokerfile](docker/Dokerfile) to install what could be missing to compile your code.
1. Update [Makefile](Makefile) to compile and run the test for your implementation .
1. Update [Makefile](Makefile) to call your makefile.
1. Create a pool request.

## Ground truth data
Expand Down
14 changes: 14 additions & 0 deletions cpp/Makefile
@@ -0,0 +1,14 @@
CPP=g++
PYTHON=python3

all: testcplusplus

OneEuroFilter.o:
$(CPP) -c -o OneEuroFilter.o OneEuroFilter.cpp

cplusplus: OneEuroFilter.o
$(CPP) -o OneEuroFilterCpp OneEuroFilter.o Test.cpp ; \
./OneEuroFilterCpp > test.csv

testcplusplus: cplusplus
$(PYTHON) ../test.py cpp test.csv
10 changes: 10 additions & 0 deletions java/Makefile
@@ -0,0 +1,10 @@
PYTHON=python3

all: testJava

javaVersion:
javac Test.java ; \
java Test > test.csv ; \

testJava: javaVersion
$(PYTHON) ../test.py java test.csv
9 changes: 9 additions & 0 deletions javascript/Makefile
@@ -0,0 +1,9 @@
PYTHON=python3

all: testJavascript

javascriptVersion:
node test.js > test.csv

testJavascript: javascriptVersion
$(PYTHON) ../test.py javascript test.csv
5 changes: 5 additions & 0 deletions python/Makefile
@@ -0,0 +1,5 @@
PYTHON=python3

all:
$(PYTHON) OneEuroFilterTest.py > test.csv ; \
$(PYTHON) ../test.py python test.csv
2 changes: 1 addition & 1 deletion test.py
Expand Up @@ -16,7 +16,7 @@
print("%s does not exist"%args.filename, file=sys.stderr)
sys.exit()

df = pandas.read_csv('groundTruth.csv')
df = pandas.read_csv('../groundTruth.csv')
df2 = pandas.read_csv(args.filename)

problem = False
Expand Down
6 changes: 6 additions & 0 deletions typescript/Makefile
@@ -0,0 +1,6 @@
PYTHON=python3

all:
npm install ; \
tsc ; \
node dist/test.js > test.csv

0 comments on commit b239093

Please sign in to comment.