From c349a97ea1e8e103c073e531ab8fc1eda7b01405 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 25 Jan 2011 18:34:11 +0000 Subject: [PATCH] rework the xspice/icm Makefile for build in a separate directory --- ChangeLog | 11 +++ configure.ac | 1 + src/xspice/Makefile.am | 1 + src/xspice/icm/GNUmakefile.in | 169 ++++++++++++++++++++++++++++++++++ src/xspice/icm/Makefile | 164 --------------------------------- src/xspice/icm/makedefs.in | 21 ++--- src/xspice/icm/modpath.lst | 1 - src/xspice/icm/objects.inc | 1 - 8 files changed, 190 insertions(+), 179 deletions(-) create mode 100644 src/xspice/icm/GNUmakefile.in delete mode 100644 src/xspice/icm/Makefile delete mode 100644 src/xspice/icm/modpath.lst delete mode 100644 src/xspice/icm/objects.inc diff --git a/ChangeLog b/ChangeLog index 1acc2a84b..7426bb2e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-01-25 Robert Larice + * Modified configure.ac , + * Modified src/xspice/Makefile.am , + * Added src/xspice/icm/GNUmakefile.in , + * Removed src/xspice/icm/Makefile , + * Modified src/xspice/icm/makedefs.in , + * Removed src/xspice/icm/modpath.lst , + * Removed src/xspice/icm/objects.inc : + rework the xspice/icm Makefile for build in a separate directory + the new makefile requires GNU make + 2011-01-25 Robert Larice * src/xspice/cmpp/cmpp.h , * src/xspice/cmpp/pp_lst.c , diff --git a/configure.ac b/configure.ac index e5b95cf94..1cc4dd137 100644 --- a/configure.ac +++ b/configure.ac @@ -1089,6 +1089,7 @@ AC_CONFIG_FILES([Makefile src/xspice/cm/Makefile src/xspice/cmpp/Makefile src/xspice/icm/makedefs + src/xspice/icm/GNUmakefile src/xspice/mif/Makefile src/xspice/evt/Makefile src/xspice/enh/Makefile diff --git a/src/xspice/Makefile.am b/src/xspice/Makefile.am index 6b93e177d..df2510794 100755 --- a/src/xspice/Makefile.am +++ b/src/xspice/Makefile.am @@ -12,6 +12,7 @@ SUBDIRS = mif cm enh evt ipc idn cmpp icm dist-hook: rm -rf `find $(distdir)/examples -name CVS` rm -f "$(distdir)/icm/makedefs" + rm -f "$(distdir)/icm/GNUmakefile" rm -rf `find $(distdir)/icm -name CVS` rm -rf `find $(distdir)/icm -name .cvsignore` rm -rf `find $(distdir)/icm -name .deps` diff --git a/src/xspice/icm/GNUmakefile.in b/src/xspice/icm/GNUmakefile.in new file mode 100644 index 000000000..8b4504306 --- /dev/null +++ b/src/xspice/icm/GNUmakefile.in @@ -0,0 +1,169 @@ +# The master makefile to make spiceopus (TM) like codemodels +# Under the GPLV2 or later license +# 2003 - Stefan Jones + + +include makedefs + + +# The codemodels to make +CMDIRS = spice2poly digital analog xtradev xtraevt + + +all: + for cm in $(CMDIRS) ; do \ + $(MAKE) cm=$$cm $$cm/$$cm.cm \ + || exit 1; \ + done + + +install: all + $(MKDIR_P) "$(DESTDIR)$(libdir)/spice" + for cm in $(CMDIRS) ; do \ + $(INSTALL_PROGRAM) $$cm/$$cm.cm "$(DESTDIR)$(libdir)/spice" \ + || exit 1; \ + done + + +clean: + for cm in $(CMDIRS) ; do \ + $(MAKE) cm=$$cm cm-clean \ + || exit 1; \ + done + + +#----------------------------------------------------------------------------- + +ifdef cm + +modlst := $(shell cat $(srcdir)/$(cm)/modpath.lst) +udnlst := $(shell cat $(srcdir)/$(cm)/udnpath.lst) + +cm-dirs := $(cm) $(udnlst:%=$(cm)/%) $(modlst:%=$(cm)/%) +cm-dep-dirs := $(cm-dirs:%=%/.deps) + + +cm-gens := \ + $(modlst:%=$(cm)/%/cfunc.c) \ + $(modlst:%=$(cm)/%/ifspec.c) + +cm-objs := \ + $(cm)/dlmain.o \ + $(modlst:%=$(cm)/%/cfunc.o) \ + $(modlst:%=$(cm)/%/ifspec.o) \ + $(udnlst:%=$(cm)/%/udnfunc.o) + +cm-deps := \ + $(cm)/.deps/dlmain.P \ + $(modlst:%=$(cm)/%/.deps/cfunc.P) \ + $(modlst:%=$(cm)/%/.deps/ifspec.P) \ + $(udnlst:%=$(cm)/%/.deps/udnfunc.P) + +cm-descr := \ + $(cm)/cmextrn.h \ + $(cm)/cminfo.h \ + $(cm)/udnextrn.h \ + $(cm)/udninfo.h \ + $(cm)/objects.inc + + +-include $(cm-deps) + + +.SECONDARY : $(cm-gens) + + +cm-clean : + rm -f $(cm)/$(cm).cm + rm -f $(cm-descr) $(cm-objs) $(cm-gens) + rm -f $(cm-deps) + +#----- + +$(cm)/$(cm).cm : $(cm-objs) + $(CC) $(LDFLAGS) -o $@ $(cm-objs) + +# "order-only" prerequisites +# (info "(make) Prerequisite Types") + +$(cm-gens) $(cm-objs) $(cm-descr) : | cm-dirs + +cm-dirs : $(cm-dirs) $(cm-dep-dirs) + +$(cm-dirs) $(cm-dep-dirs) : + $(MKDIR_P) $(cm-dirs) $(cm-dep-dirs) + +#----- +# cancel builtin rules + +%.o : %.c +%.o : %.mod + +# multiple targets in a pattern group ... +# (info "(make) Pattern Intro") + +%/cmextrn.h %/cminfo.h %/udnextrn.h %/udninfo.h %/objects.inc : $(srcdir)/%/modpath.lst $(srcdir)/%/udnpath.lst + CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -lst + +%/ifspec.c : $(srcdir)/%/ifspec.ifs + CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -ifs + +%/cfunc.c : $(srcdir)/%/cfunc.mod + CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -mod + + +gen_pp = -MD -MF $(@D)/.deps/$(basename $(> $$x.P; \ + rm $$x.pp +endef + +COMPILE = $(CC) $(INCLUDES) -I$(cm) -I$(srcdir)/$(cm) $(CFLAGS) + +$(cm)/dlmain.o : $(srcdir)/dlmain.c $(cm-descr) + $(COMPILE) $(gen_pp) -o $@ -c $< + $(do-deps) + +$(cm)/%/cfunc.o : $(cm)/%/cfunc.c + $(COMPILE) $(gen_pp) -I$(srcdir)/$( - -include $(TOPDIR)makedefs - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include .deps/ifspec.P --include .deps/cfunc.P --include .deps/udnfunc.P --include .deps/cm.P --include .deps/dlmain.P - -UPMAKE := $(MAKE) -f $(TOPDIR)../Makefile TOPDIR=$(TOPDIR)../ - -MAKE := $(MAKE) -f $(TOPDIR)Makefile TOPDIR=$(TOPDIR) - -COMPILE = $(CC) $(INCLUDES) $(CFLAGS) - -INSTALL_DATA = ${INSTALL} -m 644 - -ifeq ($(ISCYGWIN), 1) - INSTALL_DATA = ${INSTALL} -m 755 -endif - -all: - @for x in $(CMDIRS) ; do \ - ( cd $$x && $(UPMAKE) $$x-mods ) \ - || exit 1; \ - done - -install: all - $(mkinstalldirs) $(DESTDIR)$(libdir)/spice - @for x in $(CMDIRS) ; do \ - echo "$(INSTALL_DATA) $$x/$$x.cm $(DESTDIR)$(libdir)/spice"; \ - $(INSTALL_DATA) $$x/$$x.cm $(DESTDIR)$(libdir)/spice \ - || exit 1; \ - done - -clean: - @for x in $(CMDIRS) ; do \ - ( cd $$x && $(UPMAKE) $$x-mods-clean ) \ - || exit 1; \ - done - -rm -rf .deps - -ifspec.c: ifspec.ifs - -rm -f $@ - $(CMPP) -ifs - -cfunc.c: cfunc.mod - -rm -f $@ - $(CMPP) -mod - -dlmain.c: $(TOPDIR)/dlmain.c - -cp $(TOPDIR)/dlmain.c . - -objects.inc cmextrn.h cminfo.h udnextrn.h udninfo.h: modpath.lst udnpath.lst - -rm -f cmextrn.h cminfo.h objects.inc udnextrn.h udninfo.h - $(CMPP) -lst - -dlmain.o: cmextrn.h cminfo.h udnextrn.h udninfo.h - -%.cm: dlmain.o objects.inc - @echo $@: objects.inc dlmain.o \\ > .deps/cm.P - @for x in `cat modpath.lst` ; do \ - echo $$x/cfunc.o $$x/ifspec.o \\ >> .deps/cm.P ; done - @for x in `cat udnpath.lst` ; do \ - echo $$x/udnfunc.o \\ >> .deps/cm.P ; done - @echo "" >> .deps/cm.P - $(CC) $(LDFLAGS) -o $@ `awk '{ print $$1 }' objects.inc` dlmain.o - -%-mods: modpath.lst udnpath.lst - @for x in `cat modpath.lst` ; do \ - ( cd $$x && $(UPMAKE) objs ) \ - || exit 1; \ - done - @for x in `cat udnpath.lst` ; do \ - ( cd $$x && $(UPMAKE) uobjs ) \ - || exit 1; \ - done - @target=`echo $@ | sed s/-mods//`; $(MAKE) $$target.cm - -%-mods-clean: - @target=`echo $@ | sed s/-mods-clean//` && rm -f $$target.cm - @for x in `cat modpath.lst` ; do \ - ( cd $$x && $(UPMAKE) objs-clean ) \ - || exit 1; \ - done - @for x in `cat udnpath.lst` ; do \ - ( cd $$x && $(UPMAKE) uobjs-clean ) \ - || exit 1; \ - done - -rm -f cmextrn.h cminfo.h objects.inc udnextrn.h udninfo.h \ - dlmain.c dlmain.o - -rm -rf .deps - - -objs: ifspec.o cfunc.o - -objs-clean: - -rm -f cfunc.c ifspec.c cfunc.o ifspec.o - -rm -rf .deps - -uobjs: udnfunc.o - -uobjs-clean: - -rm -f udnfunc.o - -rm -rf .deps - -%.o: %.c - @echo $(COMPILE) $(DEPFLAGS) .deps/$(*F).pp -c $< ; \ - $(COMPILE) $(DEPFLAGS) .deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -makedefs: $(srcdir)/makedefs.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -# Hack by SDB to enable "make mrproper" from top level. -# Since there is no Makefile.am for this directory, we need to -# incorporate this stuff by hand. -MAINTAINERCLEANFILES = - -maintainer-clean: maintainer-clean-generic - rm -f `find . -type f -name "*~" -print` - rm -f `find . -type f -name "*.orig" -print` - rm -f `find . -type f -name "*.rej" -print` - rm -fR `find . -type d -name ".deps" -print` - -maintainer-clean-generic: clean - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - - -distclean: maintainer-clean - -distdir: - -check: - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: diff --git a/src/xspice/icm/makedefs.in b/src/xspice/icm/makedefs.in index b499183c2..d06ad03d0 100644 --- a/src/xspice/icm/makedefs.in +++ b/src/xspice/icm/makedefs.in @@ -1,4 +1,6 @@ -# Edit this file to set global include paths, +# -*- makefile -*- + +# Edit this file to set global include paths, # compiler info and subdirs # Directory sturcture @@ -7,14 +9,14 @@ srcdir = @srcdir@ top_builddir = ../../.. top_srcdir = @top_srcdir@ subdir = src/xspice/icm -mkdir_p = @mkdir_p@ +MKDIR_P = @MKDIR_P@ uname = $(shell uname) - + # C compiler to use CC = @CC@ # Spice header include path -INCLUDES = -I$(TOPDIR)$(top_srcdir)/src/include -I$(TOPDIR)$(top_builddir) +INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir) # CFLAGS to use here CFLAGS = @CFLAGS@ -fPIC @@ -36,7 +38,7 @@ ifeq ($(ISSUNOS), 1) endif # Path to the cmpp utility -CMPP = $(TOPDIR)$(top_builddir)/src/xspice/cmpp/cmpp +CMPP = $(top_builddir)/src/xspice/cmpp/cmpp # Flags to use when linking shared library LDFLAGS = -shared @@ -52,17 +54,10 @@ ifeq "$(strip $(uname))" "SunOS" endif endif -# The codemodels to make -CMDIRS = spice2poly digital analog xtradev xtraevt - # Install instructions -# or use mkdir -p -#mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -mkinstalldirs = $(mkdir_p) - INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ prefix = @prefix@ exec_prefix = @exec_prefix@ diff --git a/src/xspice/icm/modpath.lst b/src/xspice/icm/modpath.lst deleted file mode 100644 index eba74545a..000000000 --- a/src/xspice/icm/modpath.lst +++ /dev/null @@ -1 +0,0 @@ -icm_spice2poly diff --git a/src/xspice/icm/objects.inc b/src/xspice/icm/objects.inc deleted file mode 100644 index fc2fd16c8..000000000 --- a/src/xspice/icm/objects.inc +++ /dev/null @@ -1 +0,0 @@ -icm_spice2poly/*.o