-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 1.83 KB
/
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
57
58
59
60
61
62
63
64
65
66
67
.POSIX:
.SUFFIXES:
FC = gfortran
CC = gcc
AR = ar
MAKE = make
PREFIX = /usr
DEBUG = -std=f2018 -g -O0 -Wall -fmax-errors=1
RELEASE = -std=f2018 -O2
FFLAGS = $(RELEASE)
CFLAGS = -O2
LDFLAGS = -I$(PREFIX)/include -L$(PREFIX)/lib
LDLIBS = -lstrophe -lexpat -lssl -lcrypto -lz
ARFLAGS = rcs
INCDIR = $(PREFIX)/include/libfortran-xmpp
LIBDIR = $(PREFIX)/lib
SRC = src/xmpp.f90 src/xmpp_macro.c src/xmpp_util.f90
OBJ = xmpp.o xmpp_macro.o xmpp_util.o
MOD = xmpp.mod xmpp_util.mod
TARGET = libfortran-xmpp.a
.PHONY: all clean debug examples install
all: $(TARGET)
examples: basic bot roster uuid
$(TARGET): $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) -c src/xmpp_macro.c
$(FC) $(FFLAGS) $(LDFLAGS) -c src/xmpp_util.f90
$(FC) $(FFLAGS) $(LDFLAGS) -c src/xmpp.f90
$(AR) $(ARFLAGS) $(TARGET) $(OBJ)
debug: $(SRC)
$(MAKE) FFLAGS="$(DEBUG)"
basic: $(TARGET) examples/basic.f90
$(FC) $(FFLAGS) $(LDFLAGS) -o basic examples/basic.f90 $(TARGET) $(LDLIBS)
bot: $(TARGET) examples/bot.f90
$(FC) $(FFLAGS) $(LDFLAGS) -o bot examples/bot.f90 $(TARGET) $(LDLIBS)
roster: $(TARGET) examples/roster.f90
$(FC) $(FFLAGS) $(LDFLAGS) -o roster examples/roster.f90 $(TARGET) $(LDLIBS)
uuid: $(TARGET) examples/uuid.f90
$(FC) $(FFLAGS) $(LDFLAGS) -o uuid examples/uuid.f90 $(TARGET) $(LDLIBS)
install: $(TARGET)
@echo "--- Installing library to $(LIBDIR)/ ..."
install -d $(LIBDIR)
install -m 644 $(TARGET) $(LIBDIR)/
@echo "--- Installing modules to $(INCDIR)/ ..."
install -d $(INCDIR)
install -m 644 $(MOD) $(INCDIR)/
clean:
if [ `ls -1 *.mod 2>/dev/null | wc -l` -gt 0 ]; then rm *.mod; fi
if [ `ls -1 *.o 2>/dev/null | wc -l` -gt 0 ]; then rm *.o; fi
if [ -e $(TARGET) ]; then rm $(TARGET); fi
if [ -e basic ]; then rm basic; fi
if [ -e bot ]; then rm bot; fi
if [ -e roster ]; then rm roster; fi
if [ -e uuid ]; then rm uuid; fi