xref: /libCEED/examples/ceed/Makefile (revision bdcc27286a8034df1dd97bd8aefef85a0efa7b00)
1# Copyright (c) 2017-2025, 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 -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# Rules for building the examples
28%: %.c
29	$(LINK.c) $(CEED_FLAGS) $(CEED_LDFLAGS) $< -o $@ $(CEED_LIBS)
30
31clean:
32	rm -f *~ $(EXAMPLES)
33	rm -rf *.dSYM *.TVD.*breakpoints
34