Commit 3d96b397 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Several fixes and improvements.

parent b01b05ea
dnl $Id: mkmi.m4,v 1.1 1994/03/03 00:44:54 ceder Exp $
dnl $Id: mkmi.m4,v 1.2 1994/03/05 17:19:28 ceder Exp $
dnl Create Makefile.in from Makefile.src
dnl
changequote([,])dnl
......@@ -14,33 +14,34 @@ dnl localcmd should typically be empty or contain commands to perform
dnl cmd in the current directory. All lines in localcmd should begin
dnl with a tab.
dnl
define([LK_descend], [[.PHONY: ]$1
define([LK_descend], [[.PHONY: $1
$1: $2
$3 [for i in DuMmY $(SUBDIRS); do \
$3 @for i in DuMmY $(SUBDIRS); do \
if test -f $$i/Makefile ; then \
echo making] $1 [in directory $$i; \
if (cd ./$$i; $(MAKE) ] $1 [ );
echo making $1 in directory $$i; \
if (cd ./$$i; $(MAKE) $1); \
then true; else exit 1; fi ; \
else true; fi; \
done
]])dnl
dnl
define([LK_cmd],[[ ]$1[
define([LK_cmd],[[ $1
]])dnl
define([domostlyclean],[LK_cmd([$(RM) $(GENERIC-MOSTLYCLEAN)])])dnl
define([doclean],)dnl
define([dodistclean],[LK_cmd([$(RM) $(GENERIC-DISTCLEAN)])])dnl
define([dorealclean],)dnl
define([dopure],)dnl
define([dopure],[LK_cmd([$(RM) $(GENERIC-PURE)])])dnl
define([LK_CLEAN],[dnl
[# Output from LK_CLEAN
GENERIC-MOSTLYCLEAN = *.o lib*.a core temp-Makefile temp-?-Makefile
GENERIC-MOSTLYCLEAN = *.o lib*.a core Makefile.in2
GENERIC-PURE = Makefile.in configure
GENERIC-DISTCLEAN = *~ .\#* TAGS dependencies Makefile]
LK_descend([[mostlyclean]],[[domostlyclean]])
LK_descend([[clean]],[[doclean]])
LK_descend([[distclean]],[[dodistclean]])
LK_descend([[realclean]],[[dorealclean]])
LK_descend([[pure]],[[dopure]])
LK_descend([mostlyclean],[domostlyclean])
LK_descend([clean],[doclean])
LK_descend([distclean],[dodistclean])
LK_descend([realclean],[dorealclean])
LK_descend([pure],[dopure])
[dopure: dorealclean]
dopure
[dorealclean: dodistclean]
......@@ -58,54 +59,83 @@ define([dodepend],)dnl
define([predepend],)dnl
dnl
define([LK_ALL_C_DEPEND],[define([dodepend],dnl
[LK_cmd([$(CC) $(DEPENDFLAG) $(CFLAGS) $(srcdir)/*.c $(C_SPECIALS) \
[LK_cmd([$(CC) $(DEPENDFLAG) $(ALL_CFLAGS) $(srcdir)/*.c $(C_SPECIALS) \
>dependencies])])dnl
define([predepend],[[$(C_SPECIALS)]])])dnl
dnl
define([LK_DEPEND],[[dependencies:
touch dependencies]
LK_descend([[depend]],[predepend],[dodepend])])dnl end LK_DEPEND
LK_descend([depend],predepend,dodepend)])dnl end LK_DEPEND
dnl
define([LK_INSTALL_HDRS],
[[INSTALL-HDRS = ]$1
[HDRS-DIR =$(INCLUDEDIR)]$2
[[INSTALL-HDRS = $1
HDRS-DIR =$(INCLUDEDIR)$2]
define([doincludes],
[[ test -d $(HDRS-DIR) || $(MKDIR) $(HDRS-DIR)
for i in $(INSTALL-HDRS) ; \
do if ( cmp $(srcdir)/$$i $(HDRS-DIR)/$$i 2>/dev/null ) ; then\
true; else\
$(RM) $(HDRS-DIR)/$$i;\
if $(INSTALL_DATA) $(srcdir)/$$i $(HDRS-DIR)/$$i; \
then true ; else exit 1; fi \
else true; fi\
done;]])dnl end of doincludes
if $(INSTALL_DATA) $(srcdir)/$$i $(HDRS-DIR)/$$i;\
then true ; else exit 1; fi; fi;\
done
]])dnl end of doincludes
])dnl end of LK_INSTALL_HDRS
dnl
define([preincludes],)dnl
define([LK_INSTALL_BUILT_HDRS],
[[INSTALL-HDRS = $1
HDRS-DIR =$(INCLUDEDIR)$2]
define([preincludes],[[$(INSTALL-HDRS)]])dnl
define([doincludes],
[[ test -d $(HDRS-DIR) || $(MKDIR) $(HDRS-DIR)
for i in $(INSTALL-HDRS) ; \
do if ( cmp $$i $(HDRS-DIR)/$$i 2>/dev/null ) ; then\
true; else\
$(RM) $(HDRS-DIR)/$$i;\
if $(INSTALL_DATA) $$i $(HDRS-DIR)/$$i;\
then true ; else exit 1; fi; fi;\
done
]])dnl end of doincludes
])dnl end of LK_INSTALL_BUILT_HDRS
dnl
define([doincludes],)dnl
define([dolibraries],)dnl
define([prelibraries],)dnl
define([LK_STD_LIBS],
[errprint(__file__:__line__:[ Use LK_STD_LIB, not LK_STD_LIB])
m4exit(1)])dnl
define([LK_STD_LIB],
[[LIBNAME = ]$1
[LIBOBJS = ]$2
[[LIBNAME = $1
LIBOBJS = $2
[$(LIBNAME): $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@]
$(LIBNAME): $(LIBOBJS)
$(AR) $(ARFLAGS) $]][[@ $]][[?
$(RANLIB) $]][[@]
define([dolibraries],
[[ $(RM) $(LIBDIR)/$(LIBNAME)
cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)]])dnl end of dolibraries
$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)
]])dnl end of dolibraries
define([prelibraries],[[$(LIBNAME)]])dnl end of prelibraries
])dnl end of LK_STD_LIB
dnl
define([prebinaries],)dnl
define([preinstall],)dnl
define([doinstall],)dnl
define([LK_DESCEND],dnl
[LK_descend([[includes]],,[doincludes])
LK_descend([[libraries]],[prelibraries],[dolibraries])
LK_descend([[binaries]])
LK_descend([[install]])
[LK_descend([includes],preincludes,doincludes)
LK_descend([libraries],prelibraries,dolibraries)
LK_descend([binaries],prebinaries)
LK_descend([install],preinstall,doinstall)
LK_DEPEND
LK_CLEAN])dnl end of LK_DESCEND
dnl
dnl
define([LK_STD],[[# Begin LK_STD
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = /bin/sh
AWK = @AWK@
......@@ -142,5 +172,5 @@ SCRIPTDIR = @SRCTOPDIR@/scripts
.c.o:
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
# END section from @STDLYSKOM@
# END section from LK_STD
]])dnl LK_STD
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment