AGILe is hosted by Hepforge, IPPP Durham

GenserBuildProblems: Makeshared.subdir

File Makeshared.subdir, 1.4 KB (added by jmonk, 10 years ago)

Make shared Genser dylibs for OS X

Line 
1#
2# Subdirectory shared library Makefile.
3#
4#                  M. Kirsanov 25.10.2006
5
6SHELL = /bin/sh
7
8
9all: entermessage $(LIBNAME)
10
11
12entermessage:
13        @echo compilation for the shared library $(LIBNAME)
14
15
16$(TMPDIR)/%.o : $(DIRNAME)/%.f
17        @mkdir -p $(TMPDIR)
18        $(FC) $(FFLAGS) $(FFLAGS2) $(FFLAGSSHARED) -c -I$(INCDIR) $< -o $@
19
20$(TMPDIR)/%.o : $(DIRNAME)/%.F
21        @mkdir -p $(TMPDIR)
22        $(FC) $(FFLAGS) $(FFLAGS2) $(FFLAGSSHARED) -c -I$(INCDIR) $< -o $@
23
24$(TMPDIR)/%.o : $(DIRNAME)/%.c
25        @mkdir -p $(TMPDIR)
26        $(CC) $(CFLAGS) $(CFLAGSSHARED) -c -I$(INCDIR) $< -o $@
27
28# Creating the dependency files *.d
29
30$(TMPDIR)/%.d : $(DIRNAME)/%.F
31        @echo Making dependency for file $<; \
32        mkdir -p $(TMPDIR); \
33        $(CC) -M -I$(INCDIR) $< | \
34        sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' | \
35        sed 's/$*.o/$(TMPDIR)\/$*.o/' > $@; \
36        [ -s $@ ] || rm -f $@
37
38objects := $(patsubst $(DIRNAME)/%.f,$(TMPDIR)/%.o,$(wildcard $(DIRNAME)/*.f))
39objects += $(patsubst $(DIRNAME)/%.F,$(TMPDIR)/%.o,$(wildcard $(DIRNAME)/*.F))
40objects += $(patsubst $(DIRNAME)/%.c,$(TMPDIR)/%.o,$(wildcard $(DIRNAME)/*.c))
41
42$(LIBNAME): $(objects)
43        @mkdir -p $(LIBDIR)
44        @echo creating the shared library $@
45        $(FC) $(LDFLAGSSHARED) $(objects) -o $@ $(SHAREDFLAGS)
46##      $(FC) $(LDFLAGSSHARED) $(objects) -o $@ -shared -Wl,-soname,$(notdir $@)
47
48deps := $(patsubst $(DIRNAME)/%.F,$(TMPDIR)/%.d,$(wildcard $(DIRNAME)/*.F))
49
50ifneq ($(MAKECMDGOALS),clean)
51 ifneq ($(deps),)
52  -include $(deps)
53 endif
54endif