rework the xspice/icm Makefile for build in a separate directory

This commit is contained in:
rlar 2011-01-25 18:34:11 +00:00
parent 3fec598934
commit c349a97ea1
8 changed files with 190 additions and 179 deletions

View File

@ -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 ,

View File

@ -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

View File

@ -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`

View File

@ -0,0 +1,169 @@
# The master makefile to make spiceopus (TM) like codemodels
# Under the GPLV2 or later license
# 2003 - Stefan Jones <stefan.jones@multigig.com>
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 $(<F)).pp
define do-deps
@x=$(@D)/.deps/$(basename $(<F)) ; \
cp $$x.pp $$x.P; \
tr ' ' '\012' < $$x.pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> $$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)/$(<D) -o $@ -c $<
$(do-deps)
$(cm)/%/ifspec.o : $(cm)/%/ifspec.c
$(COMPILE) $(gen_pp) -I$(srcdir)/$(<D) -o $@ -c $<
$(do-deps)
$(cm)/%/udnfunc.o : $(srcdir)/$(cm)/%/udnfunc.c
$(COMPILE) $(gen_pp) -I$(srcdir)/$(<D) -o $@ -c $<
$(do-deps)
endif
#-----------------------------------------------------------------------------
GNUmakefile makedefs : % : $(srcdir)/%.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
maintainer-clean: distclean
distclean: clean
-rm -f GNUmakefile makedefs
distdir:
check:
pdf:
ps:
dvi:
html:
info:

View File

@ -1,164 +0,0 @@
# The master makefile to make spiceopus (TM) like codemodels
# Under the GPLV2 or later license
# 2003 - Stefan Jones <stefan.jones@multigig.com>
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:

View File

@ -1,3 +1,5 @@
# -*- makefile -*-
# Edit this file to set global include paths,
# compiler info and subdirs
@ -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@

View File

@ -1 +0,0 @@
icm_spice2poly

View File

@ -1 +0,0 @@
icm_spice2poly/*.o