-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
56 lines (47 loc) · 1016 Bytes
/
makefile
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
# Makefile for compiling guiora project
# Using cargo
# Usage: make <target> [lib=1, release=1]
PROG_NAME = guiora
OUTPUT_DIR = bin
TARGET_DIR = target
lib ?= 0
release ?= 0
ifeq ($(lib), 1)
OUTPUT_NAME = lib$(PROG_NAME).so
TARGET = lib
else
OUTPUT_NAME = $(PROG_NAME)
TARGET = bins
endif
ifeq ($(release), 1)
FLAG = --release
DIR = $(TARGET_DIR)/release/$(OUTPUT_NAME)
else
FLAG =
DIR = $(TARGET_DIR)/debug/$(OUTPUT_NAME)
endif
# Cargo
build:
@echo "Building $(OUTPUT_NAME)..."
@cargo build --$(TARGET) $(FLAG)
# Installation
install:
@echo "Installing $(OUTPUT_NAME)..."
@mkdir -p $(OUTPUT_DIR)
@cp $(DIR) $(OUTPUT_DIR)
# Compiler
all: build install
# Clean
clean:
@echo "Cleaning..."
@rm -rf $(OUTPUT_DIR)
@cargo clean
# Help
help:
@echo "Targets:"
@echo " build: Build the project"
@echo "Usage: make <target> [lib=1, release=1]"
@echo " install: Install the project"
@echo " all: Build and install the project"
@echo " clean: Clean the project"
@echo " help: Show this help"