aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-02-10 11:41:27 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-02-10 11:41:27 +0000
commita7f0e1d1b50a6e9bbb8df2279d36ef33841cd487 (patch)
tree44b2511afac2bc2d7d869ddfb994e5cda576d37c /src/Makefile
parent243dcf2ef1aca9dc29f7f82aa986f1becf954937 (diff)
restructured to allow building of both library and externals
svn path=/trunk/externals/iem/iemmatrix/; revision=14893
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile107
1 files changed, 63 insertions, 44 deletions
diff --git a/src/Makefile b/src/Makefile
index b3a03b9..17ec0fd 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,42 +1,43 @@
default: all
-.PHONEY: default all everything dist \
+-include Make.config
+
+.PHONY: default all everything dist \
clean realclean distclean \
install install-bin install-doc install-abs \
- tests
-
--include Make.config
+ tests \
+ $(LIBRAY_NAME) library externals
VPATH = .:../alias/
+.SUFFIXES: .$(EXT)
-## if $(BUILDLIBRARY) is defined, we need to include the aliases
-ifeq "$(BUILDLIBRARY)" ""
- ALIASOBJECTSOURCES=$(subst ../alias/,,$(sort $(filter %.c, $(wildcard ../alias/*.c))))
-else
- ALIASOBJECTSOURCES=
-endif
TESTDIR=../tests
-HELPERSOURCES=$(LIBRARY_NAME)_sources.c $(LIBRARY_NAME).c
-OBJECTSOURCES=$(sort $(filter-out $(HELPERSOURCES), $(filter %.c, $(wildcard *.c)))) $(ALIASOBJECTSOURCES)
+#####################
+# CORE: core library, ought to be statically-linked with each and every .pd_linux
+# LHELPER: infrastructure for iemmatrix.pd_linux
+# ????:
+# ALIAS: alias-objects, MUST NOT be linked statically into iemmatrix.pd_linux
-SOURCES=$(OBJECTSOURCES) $(HELPERSOURCES)
+CORESRC=$(LIBRARY_NAME)_binops.c $(LIBRARY_NAME)_utility.c
+LHELPERSRC=$(LIBRARY_NAME).c $(LIBRARY_NAME)_sources.c
+PDOBJECTSRC=$(sort $(filter-out $(LHELPERSRC) $(CORESRC), $(filter %.c, $(wildcard *.c))))
+ALIASSRC=$(subst ../alias/,,$(sort $(filter %.c, $(wildcard ../alias/*.c))))
-configure: configure.ac aclocal.m4
- autoconf
+ALLSRC=$(CORESRC) $(LHELPERSRC) $(PDOBJECTSRC) $(ALIASSRC)
-aclocal.m4: acinclude.m4
- aclocal
+COREOBJ=$(CORESRC:.c=.o)
+LHELPEROBJ=$(LHELPERSRC:.c=.o)
+PDOBJ=$(PDOBJECTSRC:.c=.o)
+ALIASOBJ=$(ALIASSRC:.c=.o)
-Make.config: Make.config.in configure
- ./configure $(CONFIGUREFLAGS)
+PDOBJECTS=$(PDOBJECTSRC:.c=.$(EXT))
+ALIASOBJECTS=$(ALIASSRC:.c=.$(EXT))
-$(LIBRARY_NAME)_sources.c $(LIBRARY_NAME)_sources.h:
- ./makesource.sh
--include $(SOURCES:.c=.d)
+-include $(ALLSRC:.c=.d)
## 2nd only generate depend-files when we have Make.config included
## and thus MAKEDEP_FLAGS defined
@@ -50,40 +51,35 @@ ifdef MAKEDEP_FLAGS
rm -f $@.$$$$
endif
-.SUFFIXES: .$(EXT)
-
-TARGETS = $(SOURCES:.c=.o)
-OBJECTS = $(OBJECTSOURCES:.c=.$(EXT))
-
-
-debug:
- @echo sources $(SOURCES)
- @echo alias $(ALIASOBJECTSOURCES)
- @echo targets $(TARGETS)
- @echo objects $(OBJECTS)
-
-## if $(BUILDLIBRARY) is defined, we build everything as a single library
+## if $(BUILDLIBRARY) is defined, the default is to
+## build everything as a single library
## else we build separate externals
ifneq "$(BUILDLIBRARY)" ""
all: $(LIBRARY_NAME)
cp $(LIBRARY_NAME).$(EXT) ..
else
-all: $(OBJECTS)
+all: externals
endif
-$(OBJECTS): %.$(EXT) : %.o
- $(LD) $(LFLAGS) $(AFLAGS) -o $@ $*.o $(LIBS)
+%.o : %.c
+ $(CC) $(LIBRARY_CFLAGS) $(AFLAGS) -c -o $@ $<
+
+%.$(EXT) : %.o $(COREOBJ)
+ $(LD) $(LFLAGS) $(AFLAGS) -o $@ $^ $(LIBS)
$(STRIP) $(STRIPFLAGS) $@
-$(LIBRARY_NAME): $(TARGETS) $(LIBRARY_NAME)_sources.c $(LIBRARY_NAME)_sources.h
- $(LD) $(LFLAGS) $(AFLAGS) -o $@.$(EXT) *.o $(LIBS)
- $(STRIP) $(STRIPFLAGS) $@.$(EXT)
+$(LIBRARY_NAME).$(EXT): $(COREOBJ) $(LHELPEROBJ) $(PDOBJ)
+ $(LD) $(LFLAGS) $(AFLAGS) -o $@ $^ $(LIBS)
+ $(STRIP) $(STRIPFLAGS) $@
-$(TARGETS): %.o : %.c
- $(CC) $(LIBRARY_CFLAGS) $(AFLAGS) -c -o $@ $<
+$(LIBRARY_NAME): $(LIBRARY_NAME).$(EXT)
+ @echo "$< done"
+
+externals: $(PDOBJECTS) $(ALIASOBJECTS)
+
+library: $(LIBRARY_NAME)
-externals: $(OBJECTS)
clean:
-rm -f *.$(EXT) *.o
@@ -120,3 +116,26 @@ dist: all realclean
everything: clean all install distclean
+
+#######################
+configure: configure.ac aclocal.m4
+ autoconf
+
+aclocal.m4: acinclude.m4
+ aclocal
+
+Make.config: Make.config.in configure
+ ./configure $(CONFIGUREFLAGS)
+
+$(LIBRARY_NAME)_sources.c $(LIBRARY_NAME)_sources.h:
+ ./makesource.sh
+#######################
+
+
+
+debug:
+ @echo SOURCES $(SOURCES)
+ @echo HELPERSOURCES $(HELPERSOURCES)
+ @echo ALIASSOURCES $(ALIASOBJECTSOURCES)
+ @echo TARGETS $(TARGETS)
+ @echo OBJECTS $(PDOBJECTS)