aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.in36
-rw-r--r--src/configure.ac8
-rw-r--r--src/zexy.c2
3 files changed, 32 insertions, 14 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 5281070..5488c44 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -23,12 +23,13 @@ TARNAME = $(LIBNAME)-@ZEXY_VERSION@.tgz
.SUFFIXES: .$(EXT)
# ICCFLAGS=-march=pentiumiii -axK
-PDCFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) $(LFLAGS) $(AFLAGS)
-CFLAGS = $(DEFS) $(IFLAGS) $(WFLAGS) @CFLAGS@
+Z_CFLAGS = $(DEFS) $(IFLAGS) $(WFLAGS) @CFLAGS@ -DPD $(CFLAGS)
+
+MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
LIBS = @LIBS@
-include Make.source
+SOURCES=$(sort $(filter %.c, $(wildcard *.c)))
TARGETS = $(SOURCES:.c=.o)
@@ -40,11 +41,8 @@ $(LIBNAME): $(TARGETS)
$(LD) $(LFLAGS) -o $(LIBNAME).$(EXT) *.o $(LIBS)
$(STRIP) $(STRIPFLAGS) $(LIBNAME).$(EXT)
-.c.o:
- $(CC) -c -o $@ $(CFLAGS) -DPD $*.c
-
-.o.$(EXT):
- $(CC) -o $@ $(PDCFLAGS) -DPD $*.o
+$(TARGETS): %.o : %.c
+ $(CC) -c -o $@ $(Z_CFLAGS) $*.c
clean:
@@ -52,9 +50,10 @@ clean:
cleaner: clean
-rm -f *~ _* config.*
+ -rm -f *.d *.d.*
cleanest: cleaner
- -rm -f Makefile ../*.$(EXT) Make.source
+ -rm -f Makefile ../*.$(EXT)
distclean: cleanest newmakefile
@@ -81,7 +80,18 @@ newmakefile:
echo "current:">Makefile
echo " ./configure && make">>Makefile
-make.source:
- echo "SOURCES = \\"> Make.source
- echo `ls z_*.c $(LIBNAME).c` >> Make.source
- echo >> Make.source
+## dependencies: as proposed by the GNU-make documentation
+## see http://www.gnu.org/software/make/manual/html_node/make_47.html#SEC51
+-include $(SOURCES:.c=.d)
+%.d: %.c
+ @set -e; rm -f $@; \
+ $(CC) $(MAKEDEP_FLAGS) $(Z_CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+
+Makefile: Makefile.in configure
+ ./configure
+
+configure: configure.ac
+ autoconf \ No newline at end of file
diff --git a/src/configure.ac b/src/configure.ac
index 2b81b3e..2ca7efc 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -97,6 +97,14 @@ AC_CHECK_HEADERS(stdlib.h stdio.h string.h math.h time.h sys/time.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
+### make-depend flags
+if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
+ AC_SUBST(MAKEDEP_FLAGS, "-MM")
+else
+ AC_SUBST(MAKEDEP_FLAGS, "-M")
+fi
+
+
dnl Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS(select socket strerror)
diff --git a/src/zexy.c b/src/zexy.c
index e4ff3a0..f121c22 100644
--- a/src/zexy.c
+++ b/src/zexy.c
@@ -121,7 +121,7 @@ static void *zexy_new(void)
return (void *)x;
}
-#include "z_zexy.c"
+void z_zexy_setup(void); /* defined in z_zexy.c */
void zexy_setup(void)
{