1# Makefile for null-output xerbla, both C and Fortran versions.
2# By default, the C version (libcerbla.a and *.so) is compiled and installed.
3# Set the USE_FORTRAN option to 1 to create the Fortran instead (libxerbla):
4  USE_FORTRAN = 0
5# USE_FORTRAN = 1
6
7VERSION = 1.0.3
8SO_VERSION = 1
9
10default: library
11
12# compile and install in SuiteSparse/lib
13library:
14	$(MAKE) install INSTALL=$(SUITESPARSE)
15
16all: library
17
18ifeq ($(USE_FORTRAN),0)
19    LIBRARY = libcerbla
20else
21    LIBRARY = libxerbla
22endif
23
24include ../SuiteSparse_config.mk
25
26ifeq ($(USE_FORTRAN),0)
27    COMPILE = $(CC) $(CF) -c xerbla.c
28    DEPENDS = xerbla.c xerbla.h
29else
30    COMPILE = $(F77) $(F77FLAGS) -c xerbla.f
31    DEPENDS = xerbla.f
32endif
33
34ccode: all
35
36fortran: all
37
38static: $(AR_TARGET)
39
40$(AR_TARGET): $(DEPENDS)
41	$(COMPILE)
42	$(ARCHIVE)  $(AR_TARGET) xerbla.o
43	- $(RANLIB) $(AR_TARGET)
44	- $(RM) xerbla.o
45
46# install libcerbla / libxerbla
47install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET)
48
49$(INSTALL_LIB)/$(SO_TARGET): $(DEPENDS)
50	@mkdir -p $(INSTALL_LIB)
51	@mkdir -p $(INSTALL_INCLUDE)
52	@mkdir -p $(INSTALL_DOC)
53	$(COMPILE)
54	$(CC) $(SO_OPTS) xerbla.o -o $@
55	- $(RM) xerbla.o
56	( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) )
57	( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) )
58	$(CP) xerbla.h $(INSTALL_INCLUDE)
59	chmod 755 $(INSTALL_LIB)/$(SO_TARGET)
60	chmod 644 $(INSTALL_INCLUDE)/xerbla.h
61
62# uninstall libcerbla / libxerbla
63uninstall:
64	$(RM) $(INSTALL_LIB)/$(SO_TARGET)
65	$(RM) $(INSTALL_LIB)/$(SO_PLAIN)
66	$(RM) $(INSTALL_INCLUDE)/xerbla.h
67
68distclean: purge
69
70purge: clean
71	- $(RM) -r $(PURGE)
72
73clean:
74	- $(RM) -r $(CLEAN)
75
76