cs2lint

CubeScript linter for Cube2 engine
git clone git://deadbeef.fr/cs2lint.git
Log | Files | Refs | README | LICENSE

commit 314012c6f58a2e7e0766816bb8e21932b07c14b3
parent 25a9aa77248fbf892e3f68273c40e1f6ca0a0b7d
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Tue, 28 Jul 2020 15:00:26 +0200

use a ninja build file instead of ugly script

Diffstat:
M.gitignore | 5+++--
MREADME | 3+--
Abuild.ninja | 31+++++++++++++++++++++++++++++++
Dbuild.sh | 7-------
Mmain.cpp | 2+-
5 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,2 +1,3 @@ -coco_build -cs2lint +.ninja_deps +.ninja_log +b/ diff --git a/README b/README @@ -1,10 +1,9 @@ This repo aims at creating a tool that checks CubeScript2 syntax, a so called "linter". -Needs coco-cpp and clang to build: just run build.sh. +Needs coco-cpp, clang and ninja to build: just "ninja", files will be generated in folder "b". TODO: * add TODOs -* use a real build system * document more stuff * check grammar diff --git a/build.ninja b/build.ninja @@ -0,0 +1,31 @@ +BUILD = b +COCOBUILD = $BUILD/coco_gen +CXX = clang++ +CXXFLAGS = $$CXXFLAGS -fcolor-diagnostics -D_MSC_VER=0 -I $COCOBUILD -I . +COCO = cococpp +COCOFLAGS = -frames /usr/share/coco-cpp -o $COCOBUILD +LD = clang++ +LDFLAGS = $$CXXFLAGS + +rule cxx + command = $CXX $CXXFLAGS -c $in -o $out + +rule coco + command = $COCO $COCOFLAGS $in + +rule link + command = $LD $LDFLAGS $in -o $out + +rule mkd + command = test -d $out || mkdir $out + +build $BUILD: mkd +build $COCOBUILD: mkd | $BUILD + +build $COCOBUILD/Parser.cpp $COCOBUILD/Scanner.cpp $COCOBUILD/Parser.h $COCOBUILD/Scanner.h: coco cubescript.atg | /usr/share/coco-cpp/Parser.frame /usr/share/coco-cpp/Scanner.frame + +build $BUILD/main.cpp.o: cxx main.cpp | $COCOBUILD/Parser.h $COCOBUILD/Scanner.h +build $BUILD/Parser.cpp.o: cxx $COCOBUILD/Parser.cpp +build $BUILD/Scanner.cpp.o: cxx $COCOBUILD/Scanner.cpp + +build $BUILD/cs2lint: link $BUILD/main.cpp.o $BUILD/Parser.cpp.o $BUILD/Scanner.cpp.o diff --git a/build.sh b/build.sh @@ -1,7 +0,0 @@ -#!/bin/sh - -test -e coco_build && rm -r coco_build -test -e cs2lint && rm cs2lint -mkdir coco_build -cococpp -frames /usr/share/coco-cpp/ -o coco_build cubescript.atg -clang++ main.cpp coco_build/*.cpp -o cs2lint diff --git a/main.cpp b/main.cpp @@ -3,7 +3,7 @@ #include <assert.h> #include <stdio.h> -#include "coco_build/Parser.h" +#include "b/coco_gen/Parser.h" bool parse_file( char const* file_name );