From a9d89cd1953b043fc9365d0bb9f1f97a7ca9c5ee Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 21 Jun 2018 11:25:18 +0200 Subject: [PATCH] improve build system --- GNUmakefile | 7 +- Makefile | 19 ++- config/CONFIG | 3 - config/CONFIG_APP | 14 +-- config/Makefile | 12 +- config/Makefile.Host | 17 ++- config/Makefile.Vx | 2 +- config/RELEASE | 1 - config/RULES.Db | 203 --------------------------------- config/RULES.Vx | 7 -- config/RULES.ioc | 9 -- config/RULES.iocBoot | 4 - config/RULES.munch | 6 +- config/RULES_TOP | 5 - config/convertRelease.pl | 4 +- config/makeConfigAppInclude.pl | 62 ++++++++++ config/makeDbDepends.pl | 23 ---- {src => config}/munch.pl | 0 config/replaceVAR.pl | 12 -- config/touch.pl | 31 ----- configure/Makefile | 2 +- src/Makefile | 29 ++--- src/Makefile.Host | 11 +- src/Makefile.Vx | 23 ++-- src/RULES.munch | 14 --- streamApp/Makefile | 26 ++--- streamApp/Makefile.Host | 6 +- streamApp/Makefile.Vx | 9 +- 28 files changed, 149 insertions(+), 412 deletions(-) delete mode 100644 config/CONFIG delete mode 100644 config/RELEASE delete mode 100644 config/RULES.Db delete mode 100644 config/RULES.Vx delete mode 100644 config/RULES.ioc delete mode 100644 config/RULES.iocBoot delete mode 100644 config/RULES_TOP create mode 100644 config/makeConfigAppInclude.pl delete mode 100644 config/makeDbDepends.pl rename {src => config}/munch.pl (100%) delete mode 100644 config/replaceVAR.pl delete mode 100644 config/touch.pl delete mode 100644 src/RULES.munch diff --git a/GNUmakefile b/GNUmakefile index ba0533f..f829db0 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,5 +1,5 @@ -# If you are not using the PSI build environment, this file can be removed. ifeq ($(wildcard /ioc/tools/driver.makefile),) +$(info If you are not using the PSI build environment, GNUmakefile can be removed.) include Makefile else include /ioc/tools/driver.makefile @@ -31,6 +31,11 @@ HEADERS += StreamError.h StreamCore.o StreamCore.d: streamReferences +# Update version string (contains __DATE__ and __TIME__) +# each time make runs. +StreamVersion.o: FORCE +FORCE: + streamReferences: $(PERL) ../src/makeref.pl Interface $(BUSSES) > $@ $(PERL) ../src/makeref.pl Converter $(FORMATS) >> $@ diff --git a/Makefile b/Makefile index 782b671..ddf7188 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,20 @@ TOP = .. - -# Look if we have EPICS R3.13 or R3.14 -ifneq ($(wildcard $(TOP)/configure),) - # EPICS R3.14 - DIRS = configure +ifneq ($(wildcard ../configure),) + # We are in an EPICS R3.14+ location include $(TOP)/configure/CONFIG -else ifneq ($(wildcard $(TOP)/config),) - # EPICS R3.13 +else ifneq ($(wildcard ../config),) + # We are in an EPICS R3.13 location CONFIG = $(TOP)/config - DIRS = config include $(TOP)/config/CONFIG_APP else + # Using our own local configuration TOP = . - DIRS = configure + DIRS = config configure + src_DEPEND_DIRS := $(DIRS) include $(TOP)/configure/CONFIG endif DIRS += src -src_DEPEND_DIRS = configure DIRS += streamApp streamApp_DEPEND_DIRS = src @@ -26,4 +23,4 @@ include $(CONFIG)/RULES_TOP documentation/stream.pdf: documentation/*.html documentation/*.css documentation/*.png cd documentation; makepdf -install: documentation/stream.pdf +pdf: documentation/stream.pdf diff --git a/config/CONFIG b/config/CONFIG deleted file mode 100644 index 56e8f12..0000000 --- a/config/CONFIG +++ /dev/null @@ -1,3 +0,0 @@ -#CONFIG -# Add any changes to make rules here -#CROSS_COMPILER_TARGET_ARCHS = mv167 diff --git a/config/CONFIG_APP b/config/CONFIG_APP index a4fb305..4d50c5d 100644 --- a/config/CONFIG_APP +++ b/config/CONFIG_APP @@ -1,7 +1,7 @@ #CONFIG_APP -include $(TOP)/config/RELEASE --include $(TOP)/config/RELEASE.$(HOST_ARCH) -include $(EPICS_BASE)/config/CONFIG +include $(TOP)/configure/RELEASE +-include $(TOP)/configure/RELEASE.$(HOST_ARCH) +-include $(EPICS_BASE)/config/CONFIG INSTALL_LOCATION = $(TOP) ifdef INSTALL_LOCATION_APP INSTALL_LOCATION = $(INSTALL_LOCATION_APP) @@ -10,11 +10,3 @@ endif ifdef T_A -include $(TOP)/config/O.$(T_A)/CONFIG_APP_INCLUDE endif - -# Where to install databases -INSTALL_DB = $(INSTALL_LOCATION)/db -# dbst based database optimization (default: NO) -DB_OPT = NO -# May be overridden if not all databases should be installed -INSTALLDB = $(DB) -include $(TOP)/config/CONFIG diff --git a/config/Makefile b/config/Makefile index 67946ac..449fc77 100644 --- a/config/Makefile +++ b/config/Makefile @@ -1,9 +1,7 @@ -# -# Makefile,v 1.1.2.1 1999/07/15 19:55:30 jba Exp -# - TOP=.. include $(TOP)/config/CONFIG_APP - -include $(TOP)/config/RULES_ARCHS - +ifneq ($(wildcard $(EPICS_BASE)/config),) +include $(EPICS_BASE)/config/RULES_ARCHS +else +build install clean realclean: +endif diff --git a/config/Makefile.Host b/config/Makefile.Host index 296cc4c..f3c8985 100644 --- a/config/Makefile.Host +++ b/config/Makefile.Host @@ -1,21 +1,20 @@ # -# Makefile.Host,v 1.1.2.3 2001/09/14 19:39:14 anj Exp +# $Id: Makefile.Host,v 1.1.1.1 2000/04/05 07:33:44 janousch Exp $ # TOP=../.. include $(TOP)/config/CONFIG_APP -TARGETS = checkRelease CONFIG_APP_INCLUDE +TARGETS = CONFIG_APP_INCLUDE include $(TOP)/config/RULES.Host inc:: $(TARGETS) -CONFIG_APP_INCLUDE: $(wildcard $(TOP)/config/RELEASE*) $(TOP)/config/CONFIG_APP - $(PERL) $(TOP)/config/convertRelease.pl $@ - -checkRelease: - $(PERL) $(TOP)/config/convertRelease.pl $@ - -.PHONY :: checkRelease +ifeq ($(wildcard $(TOP)/configure/RELEASE.$(HOST_ARCH)),$(TOP)/configure/RELEASE.$(HOST_ARCH)) +CONFIG_APP_INCLUDE: $(TOP)/configure/RELEASE.$(HOST_ARCH) +endif +CONFIG_APP_INCLUDE: $(TOP)/configure/RELEASE $(TOP)/config/CONFIG_APP + $(RM) $@ + @$(PERL) $(TOP)/config/makeConfigAppInclude.pl $(T_A) $@ $(TOP) diff --git a/config/Makefile.Vx b/config/Makefile.Vx index debf87a..40a2bb8 100644 --- a/config/Makefile.Vx +++ b/config/Makefile.Vx @@ -7,7 +7,7 @@ include $(TOP)/config/CONFIG_APP TARGETS = CONFIG_APP_INCLUDE -include $(TOP)/config/RULES.Vx +include $(EPICS_BASE)/config/RULES.Vx inc:: $(TARGETS) diff --git a/config/RELEASE b/config/RELEASE deleted file mode 100644 index 5893125..0000000 --- a/config/RELEASE +++ /dev/null @@ -1 +0,0 @@ -include $(TOP)/configure/RELEASE diff --git a/config/RULES.Db b/config/RULES.Db deleted file mode 100644 index 80ae217..0000000 --- a/config/RULES.Db +++ /dev/null @@ -1,203 +0,0 @@ -# RULES.Db,v 1.9.6.6 2003/03/25 23:13:22 jba Exp -# -# Rules for making things related to databases -# -MAKEBPT = $(EPICS_BASE_HOST_BIN)/makeBpt$(EXE) -DBLOADTEMPLATE = $(EPICS_BASE_HOST_BIN)/dbLoadTemplate$(EXE) -DBEXPAND = $(EPICS_BASE_HOST_BIN)/dbExpand$(EXE) -DBST = dbst -MAKEDBDEPENDS = $(PERL) $(TOP)/config/makeDbDepends.pl -REPLACEVAR = $(PERL) $(TOP)/config/replaceVAR.pl -ifndef WIN32 -TOUCH = touch -else -TOUCH = $(PERL) $(TOP)/config/touch.pl -endif - -#----------------------------------------------------------------- -# if we are not building base add base dbd dirs - -ifneq ($(EPICS_BASE),$(TOP)) -ifneq ($(EPICS_BASE),$(INSTALL_LOCATION)) -EPICS_DBDFLAGS += -I $(EPICS_BASE)/dbd -endif -endif - -#--------------------------------------------------------------- -# ---------------------------------------------------- -# create names (lists) for installed things -# ---------------------------------------------------- - -INSTALL_BPTS = $(BPTS:%= $(INSTALL_DBD)/%) -INSTALL_DBDS = $(DBDINSTALL:%= $(INSTALL_DBD)/%) -INSTALL_DBDNAME = $(DBDNAME:%= $(INSTALL_DBD)/%) -INSTALL_DATA = $(INSTALLDB:%=$(INSTALL_DB)/%) -INSTALL_TEMPLATES = $(filter %.template,$(INSTALL_DATA)) - -#--------------------------------------------------------------- -# Main targets - -all:: install - -inc:: $(INSTALL_DBDS) $(INSTALL_BPTS) $(INSTALL_TEMPLATES) - -rebuild:: clean install - -install:: inc buildInstall - -buildInstall:: build $(INSTALL_DATA) - -depends:: - -clean:: - @echo "Cleaning" - @$(RM) $(DB) $(DBDNAME) *.template *.substitutions *.db.raw \ - *.db-stamp *.edf esiread.cnf - -##################################################### "Foreign" templates - -TEMPLATE_LINKS = $(filter-out $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE)) -TEMPLATE_FILES = $(filter $(notdir $(USES_TEMPLATE)), $(USES_TEMPLATE)) -DB_STAMP = $(patsubst %.db, %.db-stamp, $(DB)) -DB_REALTARGET = $(patsubst %.db-stamp, %.db, $@) - -ifneq '$(TEMPLATE_LINKS)' '' -build:: $(notdir $(TEMPLATE_LINKS)) -endif -build:: $(INSTALL_DBDNAME) $(TEMPLATE_FILES) $(DB_STAMP) - -$(notdir $(TEMPLATE_LINKS)): %.template: -ifndef WIN32 - @$(RM) $(notdir $(TEMPLATE_LINKS)) - ln -s $(TEMPLATE_LINKS) . -# Workaround for dbLoadTemplate bug: terminate here if link target doesn't exist - @cat $(TEMPLATE_LINKS) > /dev/null -else - @$(RM) $(notdir $(TEMPLATE_LINKS)) - $(CP) $(TEMPLATE_LINKS) . -endif - -##################################################### Inflated or plain databases - -$(INSTALL_DB)/%.db: %.db-stamp - @echo "Installing database $@" - @$(INSTALL) -d -m 644 $(patsubst %.db-stamp, %.db, $<) $(@D) - -# Must have DBDNAME defined to use dbst optimization -ifndef DBDNAME -DB_OPT = NO -endif - -# dbst based database optimization -ifeq '$(DB_OPT)' 'YES' -.PRECIOUS: %.db.raw -%.db-stamp: %.db.raw $(INSTALL_DBD)/$(DBDNAME) - @echo "Optimizing database $@" - $(DBST) $(INSTALL_DBD)/$(DBDNAME) $< -d > $(DB_REALTARGET) - @$(TOUCH) $@ -%.db-stamp: %.t.db.raw $(INSTALL_DBD)/$(DBDNAME) - @echo "Optimizing database $@" - $(DBST) $(INSTALL_DBD)/$(DBDNAME) $< -d > $(DB_REALTARGET) - @$(TOUCH) $@ -else -# NO optimization => move it and keep a stamp -%.db-stamp: %.db.raw - @$(MV) $< $(DB_REALTARGET) - @$(TOUCH) $@ - @$(TOUCH) $< -%.db-stamp: %.t.db.raw - @$(MV) $< $(DB_REALTARGET) - @$(TOUCH) $@ - @$(TOUCH) $< -endif - -%.t.db.raw: %.substitutions - @echo "Inflating database from $<" - @$(RM) $@ - @$(DBLOADTEMPLATE) $< > $@ - -##################################################### CapFast filter - -%.edf:: ../%.sch $(DEPSCHS) - @if [ ! -f cad.rc -a -r ../cad.rc ] ; then ln -s ../cad.rc ; fi - $(SCH2EDIF) $(SCH2EDIF_SYSFLAGS) $(SCH2EDIF_FLAGS) $< - -##################################################### Substitution files - -$(INSTALL_DB)/%.substitutions: %.substitutions - @echo "Installing $@" - @$(INSTALL) -d -m 644 $(@F) $(@D) - -%.substitutions:: ../%.substitutions - @$(CP) $< $@ - -ifdef CREATESUBSTITUTIONS -%.substitutions:: $(word $(words $(CREATESUBSTITUTIONS)),$(CREATESUBSTITUTIONS)) - @$(CREATESUBSTITUTIONS) $* -endif - -# Better make it PRECIOUS (to get around make bug) -.PRECIOUS: %.substitutions - -##################################################### Template databases - -# Installed template files (dbLoadTemplate() on IOC side) -$(INSTALL_DB)/%.template: %.template - @echo "Installing $@" - @$(INSTALL) -d -m 644 $(@F) $(@D) - -%.template:: ../%.template - @$(CP) $< $@ - -%.template: %.edf - $(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $< - @$(REPLACEVAR) < $@.VAR > $@ - @$(RM) $@.VAR - -##################################################### Flat databases - -%.db.raw:: ../%.db - $(CP) $< $@ - -%.db.raw: %.edf - $(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $@.VAR $< - @$(REPLACEVAR) < $@.VAR > $@ - @$(RM) $@.VAR - -##################################################### DBD stuff - -$(INSTALL_DBD)/%: % - @echo "Installing $@" - @$(INSTALL) -d -m 644 $< $(@D) - -$(INSTALL_DBD)/%:: ../% - @echo "Installing $@" - @$(INSTALL) -d -m 644 $< $(@D) - -bpt%.dbd: bpt%.data - $(RM) $@ - $(MAKEBPT) $< - -bpt%.dbd:: ../bpt%.data - $(RM) $@ - $(MAKEBPT) $< - -# Patch for old applications -ifdef USER_DBDFLAGS -DBDFLAGS = $(USER_DBDFLAGS) -endif - -ifdef DBDEXPAND -$(DBDNAME): ../$(DBDEXPAND) - @echo "Expanding dbd" - @$(RM) $@ - $(DBEXPAND) $(DBDFLAGS) $< > dbExpand.tmp - $(MV) dbExpand.tmp $@ -endif - -##################################################### Dependencies - -DEPENDS: $(filter $(patsubst %.db, %.substitutions, $(DB)), $(wildcard *.substitutions)) - @$(MAKEDBDEPENDS) $^ - --include DEPENDS diff --git a/config/RULES.Vx b/config/RULES.Vx deleted file mode 100644 index eb14b9e..0000000 --- a/config/RULES.Vx +++ /dev/null @@ -1,7 +0,0 @@ -#RULES.Vx -include $(EPICS_BASE)/config/RULES.Vx -inc:: $(INSTALL_INCREC) - -# Library should be rebuilt because LIBOBJS may have changed. -$(LIBNAME): ../Makefile.Vx - diff --git a/config/RULES.ioc b/config/RULES.ioc deleted file mode 100644 index 8a91722..0000000 --- a/config/RULES.ioc +++ /dev/null @@ -1,9 +0,0 @@ -#RULES.ioc -include $(EPICS_BASE)/config/RULES_DIRS -buildInstall:: cdCommands - -cdCommands: Makefile $(wildcard $(TOP)/config/RELEASE*) - @$(PERL) $(TOP)/config/convertRelease.pl -a $(ARCH) -h $(HOST_ARCH) $@ - -clean:: - @$(RM) cdCommands diff --git a/config/RULES.iocBoot b/config/RULES.iocBoot deleted file mode 100644 index 60988fd..0000000 --- a/config/RULES.iocBoot +++ /dev/null @@ -1,4 +0,0 @@ -#RULES.iocBoot -DIRS += $(wildcard ioc*) -DIRS += $(wildcard as*) -include $(EPICS_BASE)/config/RULES_DIRS diff --git a/config/RULES.munch b/config/RULES.munch index 816a3b3..bead816 100644 --- a/config/RULES.munch +++ b/config/RULES.munch @@ -1,12 +1,14 @@ -MUNCH = $(PERL) $(INSTALL_LOCATION)/bin/$(HOST_ARCH)/munch.pl - # The original 3.13.10 munching rule does not really work well +# This is the munch.pl taken from EPICS base 3.14.8.2 +MUNCH = $(PERL) ../../config/munch.pl + build:: $(LIBNAME).munch buildInstall:: $(INSTALL_BIN)/$(LIBNAME).munch %.munch: % + @echo "Munching $<" $(RM) $*_ctct.o $*_ctdt.c $(NM) $< | $(MUNCH) > $*_ctdt.c $(GCC) -traditional $(CFLAGS) -fdollars-in-identifiers -c $(SOURCE_FLAG) $*_ctdt.c diff --git a/config/RULES_TOP b/config/RULES_TOP deleted file mode 100644 index d23bc9c..0000000 --- a/config/RULES_TOP +++ /dev/null @@ -1,5 +0,0 @@ -#RULES_TOP -include $(EPICS_BASE)/config/RULES_TOP - -uninstall:: - @$(RMDIR) $(INSTALL_DB) diff --git a/config/convertRelease.pl b/config/convertRelease.pl index 14c2d0f..6a36c62 100644 --- a/config/convertRelease.pl +++ b/config/convertRelease.pl @@ -51,8 +51,8 @@ $outfile = $ARGV[0]; @apps = (TOP); # Provides the order of apps in RELEASE file # Read the RELEASE file(s) -$relfile = "$top/config/RELEASE"; -die "Can't find config/RELEASE file" unless (-r $relfile); +$relfile = "$top/configure/RELEASE"; +die "Can't find configure/RELEASE file" unless (-r $relfile); &readRelease($relfile, \%macros, \@apps); if ($hostarch) { diff --git a/config/makeConfigAppInclude.pl b/config/makeConfigAppInclude.pl new file mode 100644 index 0000000..c9f36f3 --- /dev/null +++ b/config/makeConfigAppInclude.pl @@ -0,0 +1,62 @@ +# $Id: makeConfigAppInclude.pl,v 1.1.1.1 2000/04/05 07:33:44 janousch Exp $ + +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # makeConfigAppInclude.pl + +use Cwd; + +$arch = $ARGV[0]; +$outfile = $ARGV[1]; +$top = $ARGV[2]; + +unlink("${outfile}"); +open(OUT,">${outfile}") or die "$! opening ${outfile}"; +print OUT "#Do not modify this file.\n"; +print OUT "#This file is created during the build.\n"; + +@files =(); +push(@files,"$top/config/RELEASE"); +push(@files,"$top/config/RELEASE.${arch}"); +foreach $file (@files) { + if (-r "$file") { + open(IN, "$file") or die "Cannot open $file\n"; + while ($line = ) { + next if ( $line =~ /\s*#/ ); + chomp($line); + $_ = $line; + #the following looks for + # prefix = $(macro)post + ($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/; + if ($macro eq "") { # true if no macro is present + # the following looks for + # prefix = post + ($prefix,$post) = /(.*)\s*=\s*(.*)/; + } else { + $base = $applications{$macro}; + if ($base eq "") { + #print "error: $macro was not previously defined\n"; + } else { + $post = $base . $post; + } + } + $applications{$prefix} = $post; + if ( -d "$post") { #check that directory exists + print OUT "\n"; + if ( -d "$post/bin/$arch") { #check that directory exists + print OUT "${prefix}_BIN = $post/bin/${arch}\n"; + } + if ( -d "$post/lib/$arch") { #check that directory exists + print OUT "${prefix}_LIB = $post/lib/${arch}\n"; + } + if ( -d "$post/include") { #check that directory exists + print OUT "EPICS_INCLUDES += -I$post/include\n"; + } + if ( -d "$post/dbd") { #check that directory exists + print OUT "EPICS_DBDFLAGS += -I $post/dbd\n"; + } + } + } + close IN; + } +} +close OUT; diff --git a/config/makeDbDepends.pl b/config/makeDbDepends.pl deleted file mode 100644 index 3069fb3..0000000 --- a/config/makeDbDepends.pl +++ /dev/null @@ -1,23 +0,0 @@ -eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- - if $running_under_some_shell; # makeDbDepends.pl - -# Called from within the object directory. -# Searches the .substitutions files (from the command line) for -# "file xxx {" entries to create a .DEPENDS file - -open(OUT, ">.DEPENDS") or die "Cannot open .DEPENDS: $!"; - -foreach $file (@ARGV) { - open(IN, "<$file") or die "Cannot open $file: $!"; - @substfile = ; - close IN or die "Cannot close $file: $!"; - - @depends = grep { s/^\s*file\s*(.*)\s*\{.*$/\1/ } @substfile; - chomp @depends; - - if (@depends) { - $file =~ s/\.substitutions/\.t.db.raw/; - print OUT "${file}:: @depends\n"; - } -} -close OUT or die "Cannot close $file: $!"; diff --git a/src/munch.pl b/config/munch.pl similarity index 100% rename from src/munch.pl rename to config/munch.pl diff --git a/config/replaceVAR.pl b/config/replaceVAR.pl deleted file mode 100644 index e874740..0000000 --- a/config/replaceVAR.pl +++ /dev/null @@ -1,12 +0,0 @@ -eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- - if $running_under_some_shell; # replaceVAR.pl - -# Called from within the object directory -# Replaces VAR(xxx) with $(xxx) -# and VAR_xxx_ with $(xxx) - -while () { - s/VAR\(/\$\(/g; - s/VAR_([^_]*)_/\$\($1\)/g; - print; -} diff --git a/config/touch.pl b/config/touch.pl deleted file mode 100644 index 503dfa5..0000000 --- a/config/touch.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# -# unix touch in Perl - -use File::Copy; -use File::Basename; - -sub Usage -{ - my ($txt) = @_; - - print "Usage:\n"; - print "\ttouch file [ file2 file3 ...]\n"; - print "\nError: $txt\n" if $txt; - - exit 2; -} - -# need at least one arg: ARGV[0] -Usage("need more args") if $#ARGV < 0; - -@targets=@ARGV[0..$#ARGV]; - -foreach $file ( @targets ) -{ - open(OUT,">$file") or die "$! creating $file"; - #print OUT "NUL\n"; - close OUT; -} - -# EOF touch.pl diff --git a/configure/Makefile b/configure/Makefile index 0317746..477cdad 100644 --- a/configure/Makefile +++ b/configure/Makefile @@ -2,7 +2,7 @@ TOP=.. -include $(TOP)/configure/CONFIG +include $(TOP)/configure/CONFIG_APP # Set the following to NO to disable consistency checking of # the support applications defined in $(TOP)/configure/RELEASE diff --git a/src/Makefile b/src/Makefile index a8a07fd..00e6b59 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,18 +18,16 @@ # # ################################################################ -TOP:=../$(TOP) - -# Look if we have EPICS R3.13 or R3.14 -ifeq ($(wildcard $(TOP)/configure),) -# EPICS R3.13 -include $(TOP)/config/CONFIG_APP -# The real work is in Makefile.Vx -include $(TOP)/config/RULES_ARCHS +TOP = ../.. +ifneq ($(wildcard ../../configure),) + include $(TOP)/configure/CONFIG +else ifneq ($(wildcard ../../config),) + include $(TOP)/config/CONFIG_APP + include $(TOP)/config/RULES_ARCHS else - -# EPICS R3.14 -include $(TOP)/configure/CONFIG + TOP= .. + include $(TOP)/configure/CONFIG +endif -include CONFIG_STREAM -include ../CONFIG_STREAM @@ -73,11 +71,10 @@ INC += devStream.h # switch off annoying rset warnings in 3.16+ CPPFLAGS += -DUSE_TYPED_RSET -include $(TOP)/configure/RULES +-include $(TOP)/configure/RULES -# Update version string (contains __DATE__ and __TIME__) -# each time make runs. -StreamVersion$(OBJ): ../*.c ../*.h ../*.cc ../CONFIG_STREAM ../Makefile +# Update version string whenever something changes +StreamVersion$(OBJ): ../*.c ../*.h ../*.cc ../CONFIG_STREAM # Add references to all registrars to main file to avoid # missing initialization. @@ -93,5 +90,3 @@ $(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM $(LIBRARY_DEFAULT).dbd$(DEP): ../CONFIG_STREAM echo $(LIBRARY_DEFAULT).dbd: $< > $@ - -endif diff --git a/src/Makefile.Host b/src/Makefile.Host index d13423f..113e2bb 100644 --- a/src/Makefile.Host +++ b/src/Makefile.Host @@ -18,20 +18,17 @@ # # ################################################################ -TOP := ../../$(TOP) +TOP = ../.. +ifneq ($(wildcard ../../../config),) +TOP = ../../.. +endif include $(TOP)/config/CONFIG_APP include ../CONFIG_STREAM DBDNAME = stream.dbd - INC += devStream.h -# This is the munch.pl taken from EPICS 3.14.8.2 -# Install script and rule. -CONFIGS = RULES.munch -SCRIPTS = munch.pl - include $(EPICS_BASE)/config/RULES.Host # create stream.dbd from all RECORDTYPES diff --git a/src/Makefile.Vx b/src/Makefile.Vx index 932726f..15e235a 100644 --- a/src/Makefile.Vx +++ b/src/Makefile.Vx @@ -18,32 +18,33 @@ # # ################################################################ -TOP := ../../$(TOP) +TOP = ../.. +ifneq ($(wildcard ../../../config),) +TOP = ../../.. +endif include $(TOP)/config/CONFIG_APP include ../CONFIG_STREAM LIBNAME = streamLib -SRCS.cc += $(patsubst %,../%,$(filter %.cc,$(STREAM_SRCS))) SRCS.cc += $(BUSSES:%=../%Interface.cc) SRCS.cc += $(FORMATS:%=../%Converter.cc) -SRCS.c += $(patsubst %,../%,$(filter %.c,$(STREAM_SRCS))) -SRCS.c += $(patsubst %,../dev%Stream.c,$(RECORDTYPES))) +SRCS.cc += $(filter %.cc,$(STREAM_SRCS:%=%../%)) +SRCS.c += $(RECORDTYPES:%=../dev%Stream.c) +SRCS.c += $(filter %.c,$(STREAM_SRCS:%=%../%)) LIBOBJS = $(patsubst ../%,%.o,$(basename $(SRCS.cc) $(SRCS.c))) include $(EPICS_BASE)/config/RULES.Vx -include $(TOP)/config/RULES.munch - -build:: depends +include ../../config/RULES.munch +DEPENDS: depends -include DEPENDS -# Update version string (contains __DATE__ and __TIME__) -# each time make runs. -StreamVersion.o: FORCE -FORCE: +# Update version string whenever something changes +StreamVersion.o: ../*.c ../*.h ../*.cc ../CONFIG_STREAM +$(LIBNAME): StreamVersion.o StreamCore.o: streamReferences diff --git a/src/RULES.munch b/src/RULES.munch deleted file mode 100644 index 816a3b3..0000000 --- a/src/RULES.munch +++ /dev/null @@ -1,14 +0,0 @@ -MUNCH = $(PERL) $(INSTALL_LOCATION)/bin/$(HOST_ARCH)/munch.pl - -# The original 3.13.10 munching rule does not really work well - -build:: $(LIBNAME).munch - -buildInstall:: $(INSTALL_BIN)/$(LIBNAME).munch - -%.munch: % - $(RM) $*_ctct.o $*_ctdt.c - $(NM) $< | $(MUNCH) > $*_ctdt.c - $(GCC) -traditional $(CFLAGS) -fdollars-in-identifiers -c $(SOURCE_FLAG) $*_ctdt.c - $(LINK.c) $@ $< $*_ctdt.o - diff --git a/streamApp/Makefile b/streamApp/Makefile index bbf3620..18563ca 100644 --- a/streamApp/Makefile +++ b/streamApp/Makefile @@ -1,15 +1,13 @@ -TOP:=../$(TOP) - -# Look if we have EPICS R3.13 or R3.14+ -ifeq ($(wildcard $(TOP)/configure),) -# EPICS R3.13 -include $(TOP)/config/CONFIG_APP -# The real work is in Makefile.Vx -include $(TOP)/config/RULES_ARCHS +TOP = ../.. +ifneq ($(wildcard ../../configure),) + include $(TOP)/configure/CONFIG +else ifneq ($(wildcard ../../config),) + include $(TOP)/config/CONFIG_APP + include $(TOP)/config/RULES_ARCHS else - -# EPICS R3.14+ -include $(TOP)/configure/CONFIG + TOP= .. + include $(TOP)/configure/CONFIG +endif PROD = streamApp DBD = streamApp.dbd @@ -63,13 +61,11 @@ PROD_LIBS += $(EPICS_BASE_IOC_LIBS) # switch off annoying rset warnings in 3.16+ CPPFLAGS += -DUSE_TYPED_RSET -include $(TOP)/configure/RULES +-include $(TOP)/configure/RULES ifdef BASE_3_15 clean: else clean:: endif - $(RM) core* *.log - -endif + $(RM) core* *.log tests/test.* tests/*log diff --git a/streamApp/Makefile.Host b/streamApp/Makefile.Host index e3be391..57f96de 100644 --- a/streamApp/Makefile.Host +++ b/streamApp/Makefile.Host @@ -1,5 +1,7 @@ -TOP := ../../$(TOP) +TOP = ../.. +ifneq ($(wildcard ../../../config),) +TOP = ../../.. +endif include $(TOP)/config/CONFIG_APP - include $(EPICS_BASE)/config/RULES.Host diff --git a/streamApp/Makefile.Vx b/streamApp/Makefile.Vx index 84ec40b..558bc29 100644 --- a/streamApp/Makefile.Vx +++ b/streamApp/Makefile.Vx @@ -1,4 +1,7 @@ -TOP := ../../$(TOP) +TOP = ../.. +ifneq ($(wildcard ../../../config),) +TOP = ../../.. +endif include $(TOP)/config/CONFIG_APP @@ -19,7 +22,7 @@ DBDEXPAND = streamAppInclude-3-13.dbd #CPPFLAGS += -DDEBUGFILE=StreamDebug.log include $(EPICS_BASE)/config/RULES.Vx -include $(TOP)/config/RULES.munch +include ../../config/RULES.munch -# Rebuild when LIBOBJS change +# Rebuild when LIBOBJS changes $(LIBNAME): ../base-3-13LIBOBJS