From: Thomas Walker Lynch Date: Tue, 2 Apr 2019 10:51:53 +0000 (+0200) Subject: phony fail example X-Git-Url: https://git.reasoningtechnology.com/style/rt_dark_doc.css?a=commitdiff_plain;h=0b44695148922e37a1a56ec20fb24100aabb876e;p=subu phony fail example --- diff --git a/makefile b/makefile index af4d046..2cf9bb5 100755 --- a/makefile +++ b/makefile @@ -5,7 +5,7 @@ # | grep -v deprecated | grep -v doc | sort -u | sed ':a;N;$!ba;s/\n/ /g' \ #) -MAKEABLE= module/da module/da/test module/tranche module/dispatch +MAKEABLE= module/da module/da/test module/db module/tranche module/dispatch .PHONY: all info clean dist-clean diff --git a/module/da/makefile b/module/da/makefile index 6f535ea..80b385d 100644 --- a/module/da/makefile +++ b/module/da/makefile @@ -1,5 +1,4 @@ -# da/makefile - +# da/ SHELL=/bin/bash MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc @@ -18,7 +17,11 @@ dep: .PHONY: lib lib: $(MAKE) $@ - cp src/da.lib.h include/da.h + cp $(SRCDIR)/da.lib.h $(INCDIR)/da.h + +.PHONY: exec +exec: + $(MAKE) $@ %:: $(MAKE) $@ diff --git a/module/da/makefile-flags b/module/da/makefile-flags index cb96c22..ae5fb48 100644 --- a/module/da/makefile-flags +++ b/module/da/makefile-flags @@ -1,13 +1,26 @@ MODULE=da +DEPRDIR=deprecated +DOCDIR=doc +EXECDIR=exec +INCDIR=include +LIBDIR=lib +SHAREDIR=../share +SRCDIR=src +TESTDIR=test +TMPDIR=tmp +TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) +TRYDIR=try + +DEPFILE=$(TMPDIR)/makefile-cc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure - # compiler and flags C=gcc CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB diff --git a/module/da/test/makefile b/module/da/test/makefile index b538ac2..9df325d 100644 --- a/module/da/test/makefile +++ b/module/da/test/makefile @@ -6,17 +6,19 @@ MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc -include makefile-flags -.PHONY: all lib exec -all: version deps lib exec +.PHONY: all +all: version .PHONY: dep dep: if [ -e $(DEPFILE) ]; then rm $(DEPFILE); fi $(MAKE) $@ +.PHONY: lib lib: $(MAKE) $@ +.PHONY: exec exec: $(MAKE) $@ diff --git a/module/da/test/makefile-flags b/module/da/test/makefile-flags index 1904d71..37ea9c1 100644 --- a/module/da/test/makefile-flags +++ b/module/da/test/makefile-flags @@ -1,14 +1,26 @@ MODULE=test +DEPRDIR=deprecated +DOCDIR=doc +EXECDIR=exec +INCDIR=include +LIBDIR=lib +SHAREDIR=../share +SRCDIR=src +TESTDIR= +TMPDIR=tmp +TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) +TRYDIR=try + +DEPFILE=$(TMPDIR)/makefile-cc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure -TESTDIR= - # compiler and flags C=gcc CFLAGS=-std=gnu11 -fPIC -I../include -ggdb -Werror -DDEBUG -DDEBUGDB diff --git a/module/db/include/db.h b/module/db/include/db.h deleted file mode 100644 index 7563eea..0000000 --- a/module/db/include/db.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef DB_LIB_H -#define DB_LIB_H - -int dbprintf(const char *format, ...); - -#endif diff --git a/module/db/lib/libdb.a b/module/db/lib/libdb.a deleted file mode 100644 index bf6ce01..0000000 Binary files a/module/db/lib/libdb.a and /dev/null differ diff --git a/module/db/makefile b/module/db/makefile index 167b997..181818b 100644 --- a/module/db/makefile +++ b/module/db/makefile @@ -1,5 +1,4 @@ -# da/makefile - +# db SHELL=/bin/bash MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc @@ -8,12 +7,17 @@ MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc -include makefile-flags .PHONY: all -all: version dep lib exec +all: version + +.PHONY: dep +dep: + if [ -e $(DEPFILE) ]; then rm $(DEPFILE); fi + $(MAKE) $@ .PHONY: lib lib: $(MAKE) $@ - cp src/db.lib.h include/db.h + cp $(SRCDIR)/db.lib.h $(INCDIR)/db.h %:: $(MAKE) $@ diff --git a/module/db/makefile-flags b/module/db/makefile-flags index f37c595..65ef1be 100644 --- a/module/db/makefile-flags +++ b/module/db/makefile-flags @@ -1,13 +1,26 @@ MODULE=db +DEPRDIR=deprecated +DOCDIR=doc +EXECDIR=exec +INCDIR=include +LIBDIR=lib +SHAREDIR=../share +SRCDIR=src +TESTDIR=test +TMPDIR=tmp +TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) +TRYDIR=try + +DEPFILE=$(TMPDIR)/makefile-cc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure - # compiler and flags C=gcc CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB diff --git a/module/dispatch/#makefile# b/module/dispatch/#makefile# new file mode 100644 index 0000000..d8fe923 --- /dev/null +++ b/module/dispatch/#makefile# @@ -0,0 +1,44 @@ +# src-dispatch/makefile + +SHELL=/bin/bash +MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc +#MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc + +-include makefile-flags + + +.PHONY: all +all: version + +.PHONY: info +info: + @echo "TRCDIR: " $(TRCDIR) + $(MAKE) $@ + +.PHONY: setup +setup: + [ ! -e $(TRCDIR) ] && mkdir $(TRCDIR) || true + $(MAKE) $@ + +.PHONY: dep +dep: + if [ -e $(DEPFILE) ]; then rm $(DEPFILE); fi + @trcsources=$(wildcard $(TRCDIR)/*.trc.c)$(wildcard $(TRCDIR)/*.trc.cc);\ + if [ ! -z "$$trcsources" ]; then\ + trctargets=$$(tranche-target $$trcsources -sep " " -tdir $(SRCDIR) );\ + $(ECHO) $$trcsources;\ + tranche-make $$trcsources -tdir $(SRCDIR) -mfile $(DEPFILE);\ + $(MAKE) $$trctargets;\ + fi + $(MAKE) $@ + +.PHONY: lib +lib: + $(MAKE) $@ + +o%:: + $(MAKE) $@ + + + + diff --git a/module/dispatch/makefile b/module/dispatch/makefile index 0714330..82d110d 100644 --- a/module/dispatch/makefile +++ b/module/dispatch/makefile @@ -5,7 +5,7 @@ MAKE=/usr/bin/make --no-print-directory -f $(PROJECT_SUBU)/tool/lib/makefile-cc #MAKE=/usr/bin/make -f $(PROJECT_SUBU)/tool/lib/makefile-cc -include makefile-flags -DEPFILE=$(TMPDIR)/makefile-cc.deps + .PHONY: all all: version @@ -23,11 +23,10 @@ setup: .PHONY: dep dep: if [ -e $(DEPFILE) ]; then rm $(DEPFILE); fi - trcsources=$(wildcard $(TRCDIR)/*.trc.c)$(wildcard $(TRCDIR)/*.trc.cc);\ - $(ECHO) $$trcsources;\ + @trcsources=$(wildcard $(TRCDIR)/*.trc.c)$(wildcard $(TRCDIR)/*.trc.cc);\ if [ ! -z "$$trcsources" ]; then\ trctargets=$$(tranche-target $$trcsources -sep " " -tdir $(SRCDIR) );\ - $(ECHO) $$trctargets;\ + $(ECHO) $$trcsources;\ tranche-make $$trcsources -tdir $(SRCDIR) -mfile $(DEPFILE);\ $(MAKE) $$trctargets;\ fi diff --git a/module/dispatch/makefile-flags b/module/dispatch/makefile-flags index b493dae..854b84f 100644 --- a/module/dispatch/makefile-flags +++ b/module/dispatch/makefile-flags @@ -1,22 +1,33 @@ MODULE=dispatch +DEPRDIR=deprecated +DOCDIR=doc +EXECDIR=exec +INCDIR=include +LIBDIR=lib +SHAREDIR=../share +SRCDIR=tmp +TESTDIR=test +TMPDIR=tmp +TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) +TRCDIR=trc +TRYDIR=try + +DEPFILE=$(TMPDIR)/makefile-trc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure - # compiler and flags C=gcc -CFLAGS=-std=gnu11 -fPIC -I. -ggdb -Werror -DDEBUG -DDEBUGDB -#CFLAGS=-std=gnu11 -fPIC -I. -Werror +CFLAGS=-std=gnu11 -fPIC -I. -I../share/include -ggdb -Werror -DDEBUG -DDEBUGDB +#CFLAGS=-std=gnu11 -fPIC -I. -I../share/include -Werror LINKFLAGS=-L1_lib -lda -TMPDIR=tmp -SRCDIR=tmp -TRCDIR=trc diff --git a/module/share/include/db.h b/module/share/include/db.h new file mode 100644 index 0000000..7563eea --- /dev/null +++ b/module/share/include/db.h @@ -0,0 +1,6 @@ +#ifndef DB_LIB_H +#define DB_LIB_H + +int dbprintf(const char *format, ...); + +#endif diff --git a/module/share/lib/libda.a b/module/share/lib/libda.a index 0ca94fb..c6e819f 100644 Binary files a/module/share/lib/libda.a and b/module/share/lib/libda.a differ diff --git a/module/share/lib/libdb.a b/module/share/lib/libdb.a new file mode 100644 index 0000000..c40204a Binary files /dev/null and b/module/share/lib/libdb.a differ diff --git a/module/tranche/makefile-flags b/module/tranche/makefile-flags index cd54223..076600d 100644 --- a/module/tranche/makefile-flags +++ b/module/tranche/makefile-flags @@ -1,15 +1,27 @@ MODULE=tranche +DEPRDIR=deprecated +DOCDIR=doc +EXECDIR=exec +INCDIR=include +LIBDIR=lib +SHAREDIR=../share +SRCDIR=src +TESTDIR= +TMPDIR=tmp +TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) +TRYDIR=try + +DEPFILE=$(TMPDIR)/makefile-cc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # some versions of Linux need a -e option others complain if there is a -e .. and it isn't the binary for echo .. ECHO= echo #ECHO= echo -e -# directories used by this makefile, these could all be set to dot for -# the simplest source directory structure -EXECDIR=exec - C=gcc CFLAGS=-std=gnu11 -fPIC -I. -I../share/include -ggdb -Werror -DDEBUG -DDEBUGDB -#CFLAGS=-std=gnu11 -fPIC -I. -Werror +#CFLAGS=-std=gnu11 -fPIC -I. -I../share/include -Werror LINKFLAGS=-Llib -L../share/lib/ -lda -ltranche diff --git a/tool/lib/makefile-cc b/tool/lib/makefile-cc index de023af..4d548e9 100755 --- a/tool/lib/makefile-cc +++ b/tool/lib/makefile-cc @@ -31,7 +31,6 @@ EXEC= $(patsubst %, $(EXECDIR)/%, $(C_BASE_CLI) $(CC_BASE_CLI)) # default directory seteup # - DEPRDIR=deprecated DOCDIR=doc EXECDIR=exec @@ -44,6 +43,10 @@ TMPDIR=tmp TOOLDIR=$(realpath $(PROJECT_SUBU)/tool) TRYDIR=try +DEPFILE=$(TMPDIR)/makefile-cc.deps +LIBFILE=$(LIBDIR)/lib$(MODULE).a +INCFILE=$(INCDIR)/$(MODULE).h + # a single space literal, for example if you wanted to subsitute commas to # spaces: $(subst $(space),;,$(string)) @@ -60,11 +63,6 @@ CC= -include makefile-flags -DEPFILE=$(TMPDIR)/makefile-cc.deps -LIBFILE=$(LIBDIR)/lib$(MODULE).a -INCFILE=$(INCDIR)/$(MODULE).h - - #-------------------------------------------------------------------------------- # targets diff --git a/try/phony_general_targets/makefile b/try/phony_general_targets/makefile new file mode 100644 index 0000000..07604b4 --- /dev/null +++ b/try/phony_general_targets/makefile @@ -0,0 +1,11 @@ + + +.PHONY: lib version + +version: + @echo "version 0.1" + +%:: + @echo $@ + + diff --git a/try/phony_general_targets/transcript.txt b/try/phony_general_targets/transcript.txt new file mode 100644 index 0000000..56766ea --- /dev/null +++ b/try/phony_general_targets/transcript.txt @@ -0,0 +1,42 @@ +2019-04-02T10:48:22Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> cat makefile + + +.PHONY: lib version + +version: + @echo "version 0.1" + +%:: + @echo $@ + + + +2019-04-02T10:48:27Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> mkdir version lib + +2019-04-02T10:48:38Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> ls +lib makefile version + +2019-04-02T10:48:42Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> make version +version 0.1 + +2019-04-02T10:48:50Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> make code +code + +2019-04-02T10:48:57Z +user@host§~/subu_land/subu/try/phony_general_targets§ +> make lib +make: Nothing to be done for 'lib'. + +2019-04-02T10:49:00Z +user@host§~/subu_land/subu/try/phony_general_targets§ +>