diff --git a/.github/workflows/build_many_linux.yml b/.github/workflows/build_many_linux.yml index 2ad92a28..1b65ca32 100644 --- a/.github/workflows/build_many_linux.yml +++ b/.github/workflows/build_many_linux.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v3 - - run: make nix + - run: ./res/ci/nixish_setup.sh && make nix -j2 - env: MKN_GCC_PREFERRED: 1 diff --git a/.github/workflows/build_nix.yml b/.github/workflows/build_nix.yml index c983400b..930a3710 100644 --- a/.github/workflows/build_nix.yml +++ b/.github/workflows/build_nix.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - - run: make nix + - run: ./res/ci/nixish_setup.sh && make nix -j2 - env: MKN_GCC_PREFERRED: 1 diff --git a/.github/workflows/build_osx.yml b/.github/workflows/build_osx.yml index c3dc7ede..0a9f511b 100644 --- a/.github/workflows/build_osx.yml +++ b/.github/workflows/build_osx.yml @@ -17,12 +17,13 @@ jobs: steps: - uses: actions/checkout@v4 - - run: make bsd + - run: ./res/ci/nixish_setup.sh && make bsd -j2 - env: MKN_LIB_LINK_LIB: 1 KUL_GIT_CO: --depth 1 run: | + brew install ccache mkdir ~/.maiken && cp res/mkn/clang.yml ~/.maiken/settings.yaml KLOG=3 ./mkn build -dtKO 2 -W 9 -g 0 KLOG=3 ./mkn build -dtOp test_mod diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d982279..37bda579 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-12, macos-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -31,7 +31,7 @@ jobs: MKN_GCC_PREFERRED: 1 KUL_GIT_CO: --depth 1 run: | - make nix + ./res/ci/nixish_setup.sh && make nix -j2 KLOG=3 ./mkn build -dtKa "-std=c++17 -fPIC" -O 2 -g 0 -W 9 -o mkn_nix - if: matrix.os == 'ubuntu-latest' @@ -54,7 +54,7 @@ jobs: container: quay.io/pypa/manylinux2014_x86_64 steps: - uses: actions/checkout@v3 - - run: make nix + - run: ./res/ci/nixish_setup.sh && make nix -j2 - env: MKN_GCC_PREFERRED: 1 KUL_GIT_CO: --depth 1 @@ -70,7 +70,7 @@ jobs: runs-on: macos-12 steps: - uses: actions/checkout@v4 - - run: make bsd + - run: ./res/ci/nixish_setup.sh && make bsd -j2 - env: MKN_GCC_PREFERRED: 1 KUL_GIT_CO: --depth 1 @@ -86,7 +86,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - run: make bsd + - run: ./res/ci/nixish_setup.sh && make bsd -j2 - env: MKN_GCC_PREFERRED: 1 KUL_GIT_CO: --depth 1 diff --git a/Makefile b/Makefile index baff82ff..6cb85080 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,4 @@ -KUL_GIT=master -YAML_GIT=master - CWD:=$(CURDIR) ifeq ($(strip $(CURDIR)),) CWD:=$(.CURDIR) @@ -9,18 +6,20 @@ endif OS = CXX=g++ -CXXFLAGS=-std=c++17 -Os -Wall -fmessage-length=0 -fPIC -g3 +CXXFLAGS=-std=c++17 -O2 -Wall -fmessage-length=0 -fPIC INCS = -Iinc \ - -Iext/parse/yaml/$(YAML_GIT)/p/include \ - -Iext/mkn/kul/$(KUL_GIT)/inc \ - -Iext/mkn/kul/$(KUL_GIT)/os/$(OS)/inc \ - -Iext/mkn/kul/$(KUL_GIT)/os/nixish/inc - -YAML = ext/parse/yaml/$(YAML_GIT)/p/bin/libyaml.a + -Iext/parse/yaml/p/include \ + -Iext/mkn/kul/inc \ + -Iext/mkn/kul/os/$(OS)/inc \ + -Iext/mkn/kul/os/nixish/inc +YAML = bin/yaml/libyaml.a LDFLAGS = -pthread -ldl -rdynamic -EXE=mkn -WHICH=which +YAML_SOURCES :=$(shell find ext/parse/yaml/p/src -type f -name '*.cpp') +YAML_LIB :=$(YAML_SOURCES:.cpp=) + +MKN_SOURCES :=$(shell find src -type f -name '*.cpp') +MKN_BIN :=$(MKN_SOURCES:.cpp=) entry: @@echo "Options include" @@ -41,53 +40,23 @@ bsd: $(eval CXXFLAGS := $(CXXFLAGS)) $(MAKE) general OS=$(OS) -prechecks: - @if [ -z "$$($(WHICH) git)" ]; then echo "git NOT FOUND - EXITING"; exit 1; fi - general: - $(MAKE) prechecks - - @if [ ! -d "./ext/mkn/kul/$(KUL_GIT)" ]; then \ - git clone --depth 1 https://github.com/mkn/mkn.kul.git --branch $(KUL_GIT) ext/mkn/kul/$(KUL_GIT); \ - fi; - - @if [ ! -d "ext/parse/yaml/$(YAML_GIT)" ]; then \ - git clone --depth 1 https://github.com/mkn/parse.yaml.git --branch $(YAML_GIT) ext/parse/yaml/$(YAML_GIT); \ - cd ext/parse/yaml/$(YAML_GIT); \ - ./mkn.sh; \ - cd ../../..; \ - fi; - @if [ ! -d "ext/parse/yaml/$(YAML_GIT)/p/bin" ]; then \ - mkdir ext/parse/yaml/$(YAML_GIT)/p/bin; \ - fi; - @if [ ! -f "$(YAML)" ]; then \ - $(MAKE) caml; \ - $(MAKE) yaml; \ - fi; - - @mkdir -p bin; - - @for f in $(shell find src -type f -name '*.cpp'); do \ - echo $(CXX) $(CXXFLAGS) $(INCS) -o "bin/$$(basename $$f).o" -c "$$f"; \ - $(CXX) $(CXXFLAGS) $(INCS) -o "bin/$$(basename $$f).o" -c "$$f" || exit 1 ; \ - done; - @$(CXX) $(CXXFLAGS) $(INCS) -o "bin/mkn.cpp.o" -c "mkn.cpp" + @mkdir -p bin/yaml bin/mkn; + $(MAKE) compile $(MAKE) link - @@rm -rf ext bin + @@rm -rf bin ext -link: - $(eval FILES := $(foreach dir,$(shell find bin -type f -name *.o),$(dir))) - $(CXX) -o "$(EXE)" $(FILES) $(YAML) $(LDFLAGS) +compile:$(YAML_LIB) $(MKN_BIN) + $(CXX) $(CXXFLAGS) $(INCS) -o "bin/mkn/main.o" -c "mkn.cpp" -caml: - @for f in $(shell find ext/parse/yaml/$(YAML_GIT)/p/src -type f -name '*.cpp'); do \ - echo $(CXX) $(CXXFLAGS) -Iext/parse/yaml/$(YAML_GIT)/p/include -o "ext/parse/yaml/$(YAML_GIT)/p/bin/$$(basename $$f).o" -c "$$f"; \ - $(CXX) $(CXXFLAGS) -Iext/parse/yaml/$(YAML_GIT)/p/include -o "ext/parse/yaml/$(YAML_GIT)/p/bin/$$(basename $$f).o" -c "$$f" || exit 1 ; \ - done; +link: + ar -r $(YAML) bin/yaml/*.o + $(CXX) -o "mkn" bin/mkn/*.o $(YAML) $(LDFLAGS) -yaml: - $(eval FILES := $(foreach dir,$(shell find ext/parse/yaml/$(YAML_GIT)/p/bin -type f -name *.o),$(dir))) - ar -r $(YAML) $(FILES) +$(YAML_LIB):$(YAML_SOURCES) + $(CXX) $(CXXFLAGS) -Iext/parse/yaml/p/include -o "bin/yaml/$(shell basename $@).o" -c $@.cpp +$(MKN_BIN):$(MKN_SOURCES) + $(CXX) $(CXXFLAGS) $(INCS) -o "bin/mkn/$(shell basename $@).o" -c $@.cpp clean: - rm -rf bin ext + rm -rf bin diff --git a/res/ci/mac_bintray.json b/res/ci/mac_bintray.json deleted file mode 100644 index 9bf32428..00000000 --- a/res/ci/mac_bintray.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "package": { - "name": "mkn", - "repo": "maiken", - "subject": "dekken", - "desc": "I was pushed completely automatically", - "website_url": "www.jfrog.com", - "issue_tracker_url": "https://github.com/bintray/bintray-client-java/issues", - "vcs_url": "https://github.com/bintray/bintray-client-java.git", - "github_use_tag_release_notes": true, - "github_release_notes_file": "RELEASE.txt", - "licenses": ["BSD-3"], - "labels": ["none"], - "public_download_numbers": false, - "public_stats": false - }, - - "version": { - "name": "0.5", - "desc": "Yes", - "released": "2019-07-30", - "vcs_tag": "0.5", - "gpgSign": false - }, - "files": - [ - {"includePattern": "/Users/travis/build/Dekken/maiken/bin/build/mkn", "uploadPattern": "osx/master/mkn", - "matrixParams": { "override": 1 } }, - {"includePattern": "/Users/travis/build/Dekken/maiken/bin/lib/libmkn.so", "uploadPattern": "osx/master/libmkn.so", - "matrixParams": { "override": 1 } } - ], - "publish": true -} diff --git a/res/ci/nix_bintray.json b/res/ci/nix_bintray.json deleted file mode 100644 index 78d07370..00000000 --- a/res/ci/nix_bintray.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "package": { - "name": "mkn", - "repo": "maiken", - "subject": "dekken", - "desc": "I was pushed completely automatically", - "website_url": "www.jfrog.com", - "issue_tracker_url": "https://github.com/bintray/bintray-client-java/issues", - "vcs_url": "https://github.com/bintray/bintray-client-java.git", - "github_use_tag_release_notes": true, - "github_release_notes_file": "RELEASE.txt", - "licenses": ["BSD-3"], - "labels": ["none"], - "public_download_numbers": false, - "public_stats": false - }, - - "version": { - "name": "0.5", - "desc": "Yes", - "released": "2019-07-30", - "vcs_tag": "0.5", - "gpgSign": false - }, - "files": - [ - {"includePattern": "/home/travis/build/Dekken/maiken/bin/build/mkn", "uploadPattern": "nix/master/mkn", - "matrixParams": { "override": 1 } }, - {"includePattern": "/home/travis/build/Dekken/maiken/bin/lib/libmkn.so", "uploadPattern": "nix/master/libmkn.so", - "matrixParams": { "override": 1 } } - ], - "publish": true -} diff --git a/res/ci/nix_travis.sh b/res/ci/nix_travis.sh deleted file mode 100755 index 9625462f..00000000 --- a/res/ci/nix_travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $CWD/../.. -ROOT=$PWD - -export MKN_GCC_PREFERRED=1 -make nix CXX="$CXX" -CXXFLAGS="-std=c++17 -fPIC" -KLOG=3 ./mkn build -WOdKta "$CXXFLAGS" -g 0 -p static diff --git a/res/ci/nixish_setup.sh b/res/ci/nixish_setup.sh new file mode 100755 index 00000000..57b0862c --- /dev/null +++ b/res/ci/nixish_setup.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -exu +CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" && cd "$CWD"/../.. +MKN_KUL_GIT=${MKN_KUL_GIT:-master} +YAML_CPP_GIT=${YAML_CPP_GIT:-master} + +rm -rf bin && mkdir bin +[ -d "./ext/mkn/kul" ] || \ + git clone --depth 1 https://github.com/mkn/mkn.kul.git -b "${MKN_KUL_GIT}" "ext/mkn/kul"; + +[ -d "ext/parse/yaml" ] || ( + git clone --depth 1 https://github.com/mkn/parse.yaml.git --branch "${YAML_CPP_GIT}" "ext/parse/yaml"; + cd "ext/parse/yaml" && ./mkn.sh && mkdir -p p/bin +) diff --git a/res/ci/osx_travis.sh b/res/ci/osx_travis.sh deleted file mode 100755 index fecc1b37..00000000 --- a/res/ci/osx_travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -ex -shell_session_update() { :; } -CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $CWD/../.. -ROOT=$PWD - - -make bsd CXX="clang++" -CXXFLAGS="-std=c++17 -fPIC" -KLOG=3 ./mkn build -WOdKta "$CXXFLAGS" -g 0 diff --git a/res/ci/win_appveyor.sh b/res/ci/win_appveyor.sh deleted file mode 100755 index 19843870..00000000 --- a/res/ci/win_appveyor.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $CWD/../.. -ROOT=$PWD - -$CWD/win_build.sh - -export MKN_CL_PREFERRED=1 -export PYTHON=/c/Python36-x64/python.exe -./mkn clean build -a -std:c++17 -dtKOg 0 -w mkn.ram[https] -./mkn clean build -a -std:c++17 -dtSOg 0 -p lib -$PYTHON /c/Python36-x64/Scripts/flawfinder . -rm -rf bin/build/tmp bin/build/obj -rm -rf bin/lib/tmp bin/lib/obj -mkdir -p win/master -cp bin/build/* win/master -cp bin/lib/* win/master -tar cf mkn.tar win diff --git a/res/mkn/clang.yml b/res/mkn/clang.yml index abf7e61d..acc882d7 100644 --- a/res/mkn/clang.yml +++ b/res/mkn/clang.yml @@ -10,6 +10,6 @@ remote: file: - type: cpp:cxx:cc archiver: ar -cr - compiler: ccache clang++ -std=c++17 -fPIC + compiler: clang++ -std=c++17 -fPIC linker: g++