This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile.mk
79 lines (64 loc) · 2.29 KB
/
Makefile.mk
1
2
3
4
5
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.PHONY: add-dependencies build build-debug clean run-api run-ballot-parser test
BUILD_DEBUG?=true
.EXPORT_ALL_VARIABLES:
ELECTIONGUARD_DIR="$(realpath .)/build/ElectionGuard"
# Detect operating system
ifeq ($(OS),Windows_NT)
OPERATING_SYSTEM := Windows
else
OPERATING_SYSTEM := $(shell uname 2>/dev/null || echo Unknown)
endif
add-dependencies:
ifeq ($(OPERATING_SYSTEM),Darwin)
endif
ifeq ($(OPERATING_SYSTEM),Linux)
endif
ifeq ($(OPERATING_SYSTEM),Windows)
endif
ifeq ($(BUILD_DEBUG),true)
build: build-debug
else
build: build-release
endif
build-debug: clean
if [ ! -d "build" ]; then mkdir build; fi
ifeq ($(OPERATING_SYSTEM),Windows)
cmake -S . -B build -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON
else
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON
endif
cmake --build build
build-release: clean
if [ ! -d "build" ]; then mkdir build; fi
ifeq ($(OPERATING_SYSTEM),Windows)
cmake -S . -B build -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
else
cmake -S . -B build -DBUILD_SHARED_LIBS=ON
endif
cmake --build build
clean:
rm -rf ./build/* ./api_build/* ./ballot_parser_build/*
run-api: build
if [ ! -d "api_build" ]; then mkdir api_build; fi
ifeq ($(OPERATING_SYSTEM),Windows)
CMAKE_PREFIX_PATH="./build/ElectionGuard" cmake -S examples/api -B api_build -G "MSYS Makefiles"
cmake --build api_build --target api
PATH=$(PWD)/build:$$PATH; ./api_build/api
else
ElectionGuard_DIR=$(ELECTIONGUARD_DIR) cmake -S examples/api -B api_build
cmake --build api_build --target api
./api_build/api
endif
run-ballot-parser: build
if [ ! -d "ballot_parser_build" ]; then mkdir ballot_parser_build; fi
ifeq ($(OPERATING_SYSTEM),Windows)
CMAKE_PREFIX_PATH="./build/ElectionGuard" cmake -S examples/ballot_parser -B ballot_parser_build -G "MSYS Makefiles"
cmake --build ballot_parser_build --target ballot_parser
PATH=$(PWD)/build:$$PATH; ./ballot_parser_build/ballot_parser "$(realpath .)/examples/ballot_parser/ballot_samples"
else
ElectionGuard_DIR=$(ELECTIONGUARD_DIR) cmake -S examples/ballot_parser -B ballot_parser_build
cmake --build ballot_parser_build --target ballot_parser
./ballot_parser_build/ballot_parser "$(realpath .)/examples/ballot_parser/ballot_samples"
endif
test: build
cmake --build build --target test