xref: /libCEED/examples/rust-qfunctions/Makefile (revision 346c77e6436e93de99b1714e06a264fc70d47960)
1# Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors
2# All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3#
4# SPDX-License-Identifier: BSD-2-Clause
5#
6# This file is part of CEED:  http://github.com/ceed
7
8OPT ?= -O -g
9
10# Ceed directory
11CEED_DIR ?= ../..
12CEED_FLAGS ?= -I$(CEED_DIR)/include -std=c11  $(OPT)
13CEED_LIBS ?= -Wl,-rpath,$(abspath $(CEED_DIR)/lib) -L$(CEED_DIR)/lib -lceed -L$(CEED_DIR)/examples/ceed -lm
14
15EXAMPLES.c = $(wildcard ex*.c)
16EXAMPLES = $(EXAMPLES.c:%.c=%)
17
18.SUFFIXES:
19.SUFFIXES: .c
20.PHONY: all clean
21
22all: $(EXAMPLES)
23
24# Remove built-in rules
25%: %.c
26
27# Special build rule for example 1 (rust)
28ex1-volume: ex1-volume.c
29	cargo +nightly build --release --manifest-path ex1-volume-rs/Cargo.toml --config ex1-volume-rs/.cargo/config.toml
30	$(LINK.c) $(CEED_FLAGS) $(CEED_LDFLAGS) $(abspath $<) -o $@ $(CEED_LIBS) -L$(CEED_DIR)/examples/rust-qfunctions/ex1-volume-rs/target/release -lex1_volume_rs
31
32clean:
33	rm -f *~ $(EXAMPLES)
34	rm -rf temp/
35	rm -rf *.dSYM *.TVD.*breakpoints
36