# /usr/share/doc/libgap-sage-doc/examples/Makefile
#
# Ad hoc Makefile for building and playing with the sample sources
# distributed within the debian package libgap-sage-doc.
#
# Recommended usage:
#  create a dedicated folder somewhere in your HOME directory;
#  link all the files in /usr/share/doc/libgap-sage-doc/examples in
#  the dedicated folder; launch this Makefile in the dedicated folder:
#  $ make ;
#  for a basic cleanup, consider the clean target:
#  $ make clean ;
#  for an entire cleanup, the maintainer-clean target:
#  $ make maintainer-clean ;
#  for other targets, just read the Makefile.
#
# written for Debian by Jerome Benoit <calculus@rezozer.net>
# on behalf of the Debian Science Team
# copyright: 2016-2017 Jerome Benoit <calculus@rezozer.net>
# distributed under the terms and conditions of GPL version 2 or later
#

PROGRAMS = $(patsubst %.c,%,$(wildcard *.c))

default: all

CFLAGS = $(shell pkg-config libgap-sage --cflags)
LDFLAGS = $(shell pkg-config libgap-sage --libs-only-L)
LDLIBS = $(shell pkg-config libgap-sage --libs-only-l)

all: build

build: $(PROGRAMS)

check: $(foreach eg, $(PROGRAMS), check-$(eg))

check-%: build
	@echo "*** $(subst check-,,$@) ***"
	./$(subst check-,,$@)

clean:
	$(RM) $(PROGRAMS)
	$(RM) tmp_file.txt

maintainer-clean: clean
