build: out-of-tree .so variants, oa, and latexfiles PS regen
Extend the out-of-tree build to the outliers deferred earlier, and
audit install sourcing. All are read-source / write-build now.
Tcl auto-load shared libraries (built via each module's `tcl-main`;
not part of the default TCL build, but now correct when invoked):
* lef/plot/router/ext2spice/ext2sim: the hand-written object rules
(tcllef.o, tclplot.o, tclroute.o, spicewrap.o, spicehier.o, simwrap.o,
ext2sim_main.o) compiled a bare-name source from the cwd; switch to
`-c $< -o $@` so the source is found via VPATH and the object lands in
the build tree. ext2sim_main.o also swaps the hard-coded -I${MAGICDIR}
for ${CPPFLAGS} (build + source include paths). ext2spice spice2sim
install copies $< (source script). Sibling ${MAGICDIR}/<mod>/lib*.o
refs already resolve into the build tree (MAGICDIR = build top).
oa (disabled by default; OpenAccess):
* CXX_INCLUDES -I. -> -I$(srcdir) -I${MAGICDIR} -I${MAGICSRC} so the C++
sources, generated database/database.h, and cross-module headers all
resolve out-of-tree; .deps and objects were already build-local.
doc/latexfiles PostScript regeneration:
* Split PS_SRCDIR (pre-built PS shipped in the source tree, read-only)
from PS_GENDIR (= psfiles in the build tree). `all` / the .tex.ps
rule now regenerate into PS_GENDIR (mkdir -p; latex reads $(srcdir)
via TEXINPUTS; dvips writes the build tree) instead of writing back
into the source psfiles dir. install takes each .ps from PS_GENDIR if
regenerated there, else the pre-built PS_SRCDIR copy.
Verified out-of-tree (make modules; then per-module tcl-main):
* magiclef.so / tclplot.so / tclroute.so / exttospice.so / exttosim.so
all build into the build tree (rc=0); oa.o builds into the build tree;
source tree stays clean.
* install-tcl copies each .so from the build tree.
* Install-location audit on a full `make install DESTDIR=...`: generated
data (scmos.tech, .magicrc, magic.tcl, tclmagic.so) matches the build
tree; verbatim data (glyphs, fonts, magicps.pro, man pages, doc PS)
matches the source tree.
* DESTDIR: two distinct prefixes install 376 files each, independent and
fully contained (nothing written outside DESTDIR).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
179b43b168
commit
c7bb0eeac8
|
|
@ -2,9 +2,11 @@ MAGICDIR = ../..
|
|||
|
||||
include $(MAGICDIR)/defs.mak
|
||||
|
||||
# Pre-built PostScript ships in the source tree; regenerating it (the .tex.ps
|
||||
# rule / `all` target) still writes back into the source psfiles dir.
|
||||
# PS_SRCDIR: pre-built PostScript shipped in the source tree (read-only, used by
|
||||
# install when a doc has not been regenerated).
|
||||
# PS_GENDIR: regenerated PostScript, written into the build tree (never source).
|
||||
PS_SRCDIR=${MAGICSRC}/doc/psfiles
|
||||
PS_GENDIR=psfiles
|
||||
PS_INSTDIR=$(INSTALL_LIBDIR)/magic/doc
|
||||
|
||||
.SUFFIXES: .dvi .tex .ps
|
||||
|
|
@ -25,10 +27,11 @@ GENPS=tut1.ps tut2.ps tut3.ps tut4.ps tut5.ps tut6.ps \
|
|||
tuttcl1.ps tuttcl2.ps tuttcl3.ps tuttcl4.ps tuttcl5.ps \
|
||||
tutwrl1.ps
|
||||
|
||||
SRC_GENPS= $(GENPS:%=${PS_SRCDIR}/%)
|
||||
GEN_GENPS= $(GENPS:%=${PS_GENDIR}/%)
|
||||
INST_GENPS= $(GENPS:%=$(DESTDIR)${PS_INSTDIR}/%)
|
||||
|
||||
all: $(SRC_GENPS)
|
||||
# Regenerate all PostScript into the build tree (${PS_GENDIR}).
|
||||
all: $(GEN_GENPS)
|
||||
@${RM} $(GENDVI) *.log *.aux
|
||||
|
||||
install: $(DESTDIR)${PS_INSTDIR} ${INST_GENPS}
|
||||
|
|
@ -38,21 +41,27 @@ $(DESTDIR)${PS_INSTDIR}: make-doc-dir
|
|||
make-doc-dir:
|
||||
${SCRIPTS}/mkdirs $(DESTDIR)${PS_INSTDIR}
|
||||
|
||||
$(DESTDIR)${PS_INSTDIR}/%: ${PS_SRCDIR}/% $(DESTDIR)${PS_INSTDIR}
|
||||
${CP} ${PS_SRCDIR}/$* $(DESTDIR)${PS_INSTDIR}/$*
|
||||
# Install each PostScript file from the build tree if it was regenerated there,
|
||||
# otherwise from the pre-built copy shipped in the source tree.
|
||||
$(DESTDIR)${PS_INSTDIR}/%: $(DESTDIR)${PS_INSTDIR}
|
||||
@f=${PS_GENDIR}/$*; test -f $$f || f=${PS_SRCDIR}/$*; \
|
||||
echo "${CP} $$f $(DESTDIR)${PS_INSTDIR}/$*"; \
|
||||
${CP} $$f $(DESTDIR)${PS_INSTDIR}/$*
|
||||
|
||||
.tex.ps:
|
||||
# Regenerate a .ps (into the build tree) from its .tex (in the source tree).
|
||||
${PS_GENDIR}/%.ps: %.tex
|
||||
@mkdir -p ${PS_GENDIR}
|
||||
@echo "Converting $*.tex -> $*.dvi"
|
||||
@latex $*.tex < /dev/null > /dev/null
|
||||
@TEXINPUTS=$(srcdir): latex $(srcdir)/$*.tex < /dev/null > /dev/null
|
||||
@if grep 'LaTeX Warn' $*.log; \
|
||||
then \
|
||||
echo "Detected warnings, doing second pass for $*...";\
|
||||
latex $*.tex < /dev/null > /dev/null; \
|
||||
TEXINPUTS=$(srcdir): latex $(srcdir)/$*.tex < /dev/null > /dev/null; \
|
||||
(grep 'LaTeX Warn' $*.log || (echo > /dev/null)); \
|
||||
echo; \
|
||||
fi
|
||||
@echo "Converting $*.dvi -> $(PS_SRCDIR)/$*.ps"
|
||||
@dvips -t letter $*.dvi -o $(PS_SRCDIR)/$*.ps > /dev/null
|
||||
@echo "Converting $*.dvi -> ${PS_GENDIR}/$*.ps"
|
||||
@dvips -t letter $*.dvi -o ${PS_GENDIR}/$*.ps > /dev/null
|
||||
|
||||
clean:
|
||||
${RM} $(GENDVI) $(SRC_GENPS) *.log *.aux
|
||||
${RM} $(GENDVI) $(GEN_GENPS) *.log *.aux
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ ext2sim_main: ext2sim_main.o ${EXTRA_LIBS} ${MAGICDIR}/tiles/libtiles.o
|
|||
${CC} ${LDFLAGS} ${CFLAGS} -o $@ $^ ${LD_FIRST_LIBS} ${LIBS} -lX11 -lz
|
||||
|
||||
ext2sim_main.o: ext2sim.c
|
||||
${CC} ${CFLAGS} -I${MAGICDIR} -DEXT2SIM_MAIN -c -o $@ $^
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} -DEXT2SIM_MAIN -c -o $@ $<
|
||||
|
||||
finds: finds.o ${MAGICDIR}/utils/libutils.a
|
||||
${CC} ${LDFLAGS} ${CFLAGS} -o $@ $^
|
||||
|
||||
simwrap.o: ext2sim.c
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ext2sim.c -c -o simwrap.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
exttosim${SHDLIB_EXT}: simwrap.o ${MAGICDIR}/extflat/libextflat.o
|
||||
@echo --- making exttosim Tcl library \(exttosim${SHDLIB_EXT}\)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ main: ext2spice
|
|||
tcl-main: exttospice${SHDLIB_EXT}
|
||||
|
||||
spicewrap.o: ext2spice.c ext2spice.h
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ext2spice.c -c -o spicewrap.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
spicehier.o: ext2hier.c ext2spice.h
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ext2hier.c -c -o spicehier.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
ext2spice_main.o: ext2spice.c
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -DEXT2SPICE_MAIN -c -o $@ $^
|
||||
|
|
@ -42,6 +42,6 @@ $(DESTDIR)${INSTALL_TCLDIR}/exttospice${SHDLIB_EXT}: exttospice${SHDLIB_EXT}
|
|||
|
||||
$(DESTDIR)${INSTALL_BINDIR}/spice2sim: spice2sim
|
||||
${RM} $(DESTDIR)${INSTALL_BINDIR}/spice2sim
|
||||
${CP} spice2sim $(DESTDIR)${INSTALL_BINDIR}/spice2sim
|
||||
${CP} $< $(DESTDIR)${INSTALL_BINDIR}/spice2sim
|
||||
|
||||
include ${MAGICDIR}/rules.mak
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ CLEANS += magiclef${SHDLIB_EXT} tcllef.o
|
|||
tcl-main: tcllef.o magiclef${SHDLIB_EXT}
|
||||
|
||||
tcllef.o: tcllef.c
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} tcllef.c -c -o tcllef.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
magiclef${SHDLIB_EXT}: tcllef.o ${OBJS}
|
||||
@echo --- making Tcl auto-load module \(magiclef${SHDLIB_EXT}\)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@ include ${MAGICDIR}/defs.mak
|
|||
ifeq ($(OA),)
|
||||
OA := fake_oa_stub
|
||||
endif
|
||||
CXX_INCLUDES = -I. -I${OA}/oa/include
|
||||
# -I$(srcdir): this module's C++ sources/headers (source tree)
|
||||
# -I${MAGICDIR}: build top, for the generated database/database.h
|
||||
# -I${MAGICSRC}: source top, for "<module>/<header>.h" includes
|
||||
CXX_INCLUDES = -I$(srcdir) -I${MAGICDIR} -I${MAGICSRC} -I${OA}/oa/include
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir -p .deps > /dev/null 2>&1 || :)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ CLEANS += tclplot${SHDLIB_EXT} tclplot.o
|
|||
tcl-main: tclplot.o tclplot${SHDLIB_EXT}
|
||||
|
||||
tclplot.o: tclplot.c
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} tclplot.c -c -o tclplot.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
tclplot${SHDLIB_EXT}: tclplot.o ${OBJS}
|
||||
@echo --- making Tcl auto-load module \(tclplot${SHDLIB_EXT}\)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ EXTRA_LIBS = ${MAGICDIR}/garouter/libgarouter.o \
|
|||
tcl-main: tclroute.o tclroute${SHDLIB_EXT}
|
||||
|
||||
tclroute.o: tclroute.c
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} tclroute.c -c -o tclroute.o
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $< -o $@
|
||||
|
||||
tclroute${SHDLIB_EXT}: tclroute.o ${OBJS}
|
||||
@echo --- making Tcl auto-load module \(tclroute${SHDLIB_EXT}\)
|
||||
|
|
|
|||
Loading…
Reference in New Issue