may have fixed annoying make clean bugs
authorChris Koeritz <fred@gruntose.com>
Mon, 3 Oct 2016 20:02:59 +0000 (16:02 -0400)
committerChris Koeritz <fred@gruntose.com>
Mon, 3 Oct 2016 20:02:59 +0000 (16:02 -0400)
discovered that i was reinvoking the make for any cleaning process, just in order to set the CLEAN flag.  that's really terribly broken.  luckily found the eval command which i can run inside a target to change the value of an existing environment variable.  perfect.  now in the base clam rules and not getting weird problems from using OTHER_CLEANS

nucleus/applications/bundler/makefile
nucleus/applications/bundler/makefile.bundle_creator [new file with mode: 0644]
nucleus/applications/bundler/makefile.stub [deleted file]
nucleus/applications/bundler/makefile.unpacker_stub [new file with mode: 0644]
production/feisty_meow_config.ini
scripts/clam/cpp/buildor_gen_deps.sh
scripts/clam/cpp/rules.def
scripts/clam/cpp/variables.def
scripts/clam/rules.def
scripts/clam/variables.def

index 9985446c3de2c83b26ef6a5a877dcb57205bdc0c..fec2e5537d0cd8c5e760c3a4f86c65f0e57b2408 100644 (file)
@@ -1,29 +1,28 @@
-CONSOLE_MODE = true
+include variables.def
 
-include cpp/variables.def
+# had to move to this style for these two
+# since having a makefile call another was doing
+# really unpredictable things, where the makefile
+# passed to the -f of make was actually dragging
+# in bits from the main makefile.  this was
+# tested even by saying:
+#   make -f makefile.stub clean
+# which totally isolates it to the stub file, but
+# the main makefile was still being pulled in.
+# hopefully this approach of having a neutral outer
+# maker will get rid of that broken behavior.
 
-PROJECT = app_bundle
-TYPE = application
-SOURCE = common_bundle.cpp 
-ifeq "$(OMIT_VERSIONS)" ""
-  SOURCE += bundler_version.rc
-endif
-DEFINITIONS += __BUILD_STATIC_APPLICATION__=t
-TARGETS = bundle_creator.exe
-LAST_TARGETS += make_stub
-ifeq "$(COMPILER)" "VISUAL_CPP"
-  LOCAL_HEADERS += $(THIRD_PARTY_DIR)/zlib/include
-  LOCAL_LIBRARIES += $(THIRD_PARTY_DIR)/zlib/lib
-  LIBS_USED += zlib.lib
-else
-  LIBS_USED += z
-endif
-OTHER_CLEANS += clean_stub
+LAST_TARGETS = maker
+OTHER_CLEANS = breaker
 
-include cpp/rules.def
+include rules.def
+
+maker:
+       $(MAKE) -f makefile.bundle_creator
+       $(MAKE) -f makefile.unpacker_stub
+
+breaker:
+       $(MAKE) CLEAN=t -f makefile.bundle_creator clean
+       $(MAKE) CLEAN=t -f makefile.unpacker_stub clean
 
-make_stub:
-       $(MAKE) -f makefile.stub
 
-clean_stub:
-       $(MAKE) -f makefile.stub NO_DEPS=t clean
diff --git a/nucleus/applications/bundler/makefile.bundle_creator b/nucleus/applications/bundler/makefile.bundle_creator
new file mode 100644 (file)
index 0000000..57ac433
--- /dev/null
@@ -0,0 +1,24 @@
+CONSOLE_MODE = true
+
+include cpp/variables.def
+
+PROJECT = app_bundle
+TYPE = application
+SOURCE = common_bundle.cpp 
+ifeq "$(OMIT_VERSIONS)" ""
+  SOURCE += bundler_version.rc
+endif
+DEFINITIONS += __BUILD_STATIC_APPLICATION__=t
+TARGETS = bundle_creator.exe
+
+#hmmm: these should be done with a USE_ZLIB macro.
+ifeq "$(COMPILER)" "VISUAL_CPP"
+  LOCAL_HEADERS += $(THIRD_PARTY_DIR)/zlib/include
+  LOCAL_LIBRARIES += $(THIRD_PARTY_DIR)/zlib/lib
+  LIBS_USED += zlib.lib
+else
+  LIBS_USED += z
+endif
+
+include cpp/rules.def
+
diff --git a/nucleus/applications/bundler/makefile.stub b/nucleus/applications/bundler/makefile.stub
deleted file mode 100644 (file)
index 74af1a0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-CONSOLE_MODE = true
-
-include cpp/variables.def
-
-PROJECT = app_bundle_stub
-TYPE = application
-SOURCE = common_bundle.cpp
-ifeq "$(OMIT_VERSIONS)" ""
-  SOURCE += bundler_version.rc
-endif
-DEFINITIONS += __BUILD_STATIC_APPLICATION__=t
-TARGETS = unpacker_stub.exe
-ifeq "$(COMPILER)" "VISUAL_CPP"
-  LIBS_USED += libcmt.lib shlwapi.lib zlib.lib
-  LOAD_FLAG_PREFIX += -nodefaultlib:msvcrt.lib 
-  COMPILER_FLAGS += -MT
-  LOCAL_HEADERS += $(THIRD_PARTY_DIR)/zlib/include
-  LOCAL_LIBRARIES += $(THIRD_PARTY_DIR)/zlib/lib
-else
-  LIBS_USED += z
-endif
-
-include cpp/rules.def
-
diff --git a/nucleus/applications/bundler/makefile.unpacker_stub b/nucleus/applications/bundler/makefile.unpacker_stub
new file mode 100644 (file)
index 0000000..ad646b9
--- /dev/null
@@ -0,0 +1,37 @@
+CONSOLE_MODE = true
+
+include cpp/variables.def
+
+PROJECT = app_bundle_stub
+TYPE = application
+SOURCE = common_bundle.cpp
+ifeq "$(OMIT_VERSIONS)" ""
+  SOURCE += bundler_version.rc
+endif
+DEFINITIONS += __BUILD_STATIC_APPLICATION__=t
+TARGETS = unpacker_stub.exe
+
+LAST_TARGETS = show_makefilename
+OTHER_CLEANS = mocko
+
+#hmmm: why on earth is this gunk not already available
+#  in some specialized vcpp variable?  yuck!
+ifeq "$(COMPILER)" "VISUAL_CPP"
+  LIBS_USED += libcmt.lib shlwapi.lib zlib.lib
+  LOAD_FLAG_PREFIX += -nodefaultlib:msvcrt.lib 
+  COMPILER_FLAGS += -MT
+  LOCAL_HEADERS += $(THIRD_PARTY_DIR)/zlib/include
+  LOCAL_LIBRARIES += $(THIRD_PARTY_DIR)/zlib/lib
+else
+  LIBS_USED += z
+endif
+
+include cpp/rules.def
+
+show_makefilename:
+       echo hey the makeflags are $(MAKEFLAGS)
+
+
+mocko:
+       echo got to other cleans
+
index f696d801b78c780576d22216e2bdc617d12f3e91..6efb11de3b5c46eb85d0c113b32403ae93f19e4c 100644 (file)
@@ -3,7 +3,7 @@
 # specifies the version of the code that is being constructed here.
 major=2
 minor=140
-revision=82
+revision=84
 build=0
 
 # specifies the remainder of the version record info.
index c44132c45ecce16a345c1fe9290a4f874054a417..c70fe48ba511fdd60af8887648b5b2377c5fdd0a 100755 (executable)
 #  of the License online.  Please send any updates to "fred@gruntose.com".    #
 ###############################################################################
 
+if [ ! -z "$CLEAN" ]; then
+  echo "in cleaning mode, will not build dependencies."
+  exit 0
+fi
+
 # this script finds all of the headers used by a cpp file and outputs a
 # list of other cpp files that are probably needed for building it.
 
index 722cb7a03a7ec03acdf1b6d57e2c9695a6f84ec1..73efdfd463d00e330bbd11d40777e0797ff4bc1d 100644 (file)
@@ -360,6 +360,8 @@ ifeq "$(CLEAN)" ""
 ifneq "$(findstring __BUILD_STATIC_APPLICATION__, $(DEFINITIONS))" ""
   # generate static build dependencies for all targets in the makefile.
   GENERATED_DEPS_LIST = $(TARGETS:%.exe=%.gendeps)
+else
+  GENERATED_DEPS_LIST =
 endif
 
 endif
@@ -424,10 +426,12 @@ endif
 #      $(CATCHER)$(CC) $(COMPILER_FLAGS) -c $< $(OBJECT_NAME_FLAG)$(TEMP)/$@
 #endif
 
+ifeq "$(CLEAN)" ""
 # recreate dependencies for static applications.
 %.gendeps: %.cpp
        @echo "Generating Static Deps: $*.cpp"
        $(CATCHER)$(CLAM_DIR)/cpp/buildor_gen_deps.sh "$*.cpp"
+endif
 
 ############################################################################
 
@@ -663,7 +667,7 @@ endif
 ifneq "$(CLEAN)" ""
   NO_DEPS = t
   # no dependencies get left when we are cleaning up.
-  $(shell rm -f $(DEPS_FILE))
+#  $(shell rm -f $(DEPS_FILE))
 endif
 ifneq "$(NO_COMPILE)" ""
   # non compiling projects do not need dependencies.
@@ -675,17 +679,10 @@ ifneq "$(REBUILD)" ""
   $(shell rm -f $(DEPS_FILE))
 endif
 
-# includes the auto-dependency information.  the dependency file is checked
-# for being up-to-date.  if not, it gets rebuilt and the make is restarted.
-ifeq "$(CLEAN)" ""
-  ifeq "$(NO_DEPS)" ""
-    include $(DEPS_FILE)
-  endif
-endif
-
 # preserves intermediate files from being deleted.
 ifeq "$(CLEAN)" ""
-.PRECIOUS: $(OBJECT_DIR)/%.obj $(OBJECT_DIR)/%.res $(OBJECT_DIR)/%.resources
+.PRECIOUS: $(OBJECT_DIR)/%.obj $(OBJECT_DIR)/%.res $(OBJECT_DIR)/%.resources $(OBJECT_DIR)/%.deps
+#hmmm: added above deps.  maybe not right.
 endif
 
 # zaps things when they could not be created correctly.
@@ -703,6 +700,7 @@ ifneq "$(NO_DEPS)" ""
     $(DEPS_FILE): $(PARAMETER_FILE)
 
 else
+  ifeq "$(CLEAN)" ""
   deps: $(DEPS_FILE)
 
   # this causes the dependency file to be regenerated if the sources or libs
@@ -734,6 +732,12 @@ else
 #      $(CATCHER)$(CLAM_BINARY_DIR)/makedep$(EXE_END) $(DEPENDENCY_DEFINITIONS:%=-D%) $(DEPENDENCY_ADDITIONS) -f$@ -o.obj -p$(OBJECT_DIR)/ -w 420 $(COMPILER_HEADER_DIR:%=-X%) $(THIRD_PARTY_DIR:%=-X%) -- $(COMPILER_FLAGS) $(SOURCE) $(EXE_CPPS)
        @echo $@ >$(SUBMAKE_FLAG)
   endif # non-compile.
+ else # cleaning.
+    # makes the dependencies a no-op for cleaning.
+    deps: $(PARAMETER_FILE)
+
+    $(DEPS_FILE): $(PARAMETER_FILE)
+ endif
 endif # no-deps.
 
 ############################################################################
@@ -745,6 +749,22 @@ check_requirements:
  
 ############################################################################
 
+# includes the auto-dependency information.  the dependency file is checked
+# for being up-to-date.  if not, it gets rebuilt and the make is restarted.
+ifeq "$(CLEAN)" ""
+  ifeq "$(NO_DEPS)" ""
+
+    # thank the buddha for this bit of code, or at least thank this page:
+    # http://stackoverflow.com/questions/5553352/how-do-i-check-if-file-exists-in-makefile
+    ifneq ("$(wildcard $(DEPS_FILE))","")
+      include $(DEPS_FILE)
+    endif
+
+  endif
+endif
+
+############################################################################
+
 # calls the script for preparing output directories and such.
 pre_compilation:
        $(HIDESH)$(CLAM_DIR)/cpp/preconditions.sh
index baa42e1f7a0583b352362e9ab761cbcbf74c4740..222a9d6d225d8c2d4c32bc54ba724217c09396bf 100644 (file)
@@ -287,7 +287,7 @@ export DEPS_FILE = $(OUTPUT_PATH)/$(PROJECT).deps
 
 # Add the obligatory junk to be cleaned up.  Individual compiler sections
 # should customize this by adding their object output directories.
-CLEANUPS += $(ACTUAL_TARGETS) $(OUTPUT_PATH)
+CLEANUPS += $(ACTUAL_TARGETS) $(OUTPUT_PATH) $(DEPS_FILE)
 
 # "GENDEPS" is a flag that causes dependencies to be generated into
 # statically built applications.
index e9f91b155d5aa7ee70d4107ed9a323a480b8a0d4..a526fb1f392a53c82c768a1ab43dab852f6d93a6 100644 (file)
@@ -110,10 +110,13 @@ exit 0'
 # files and such that were created by the project.  it invokes the makefile
 # again with the CLEAN variable defined so that this can be passed down into
 # all subsequent makes.
-clean: 
-       $(HIDER)$(MAKE) --silent CLEAN=t ready_to_clean
+clean: set_cleaner_variable clean_subdirs $(OTHER_CLEANS) ready_to_clean
+       # no code here.
 
-ready_to_clean: $(OTHER_CLEANS) clean_subdirs
+set_cleaner_variable:
+       $(eval CLEAN := true)
+
+ready_to_clean:
        @echo Whacking [$(CLEANUPS)]
        $(HIDESH) -c '\
 echo the other cleans were: $(OTHER_CLEANS); \
@@ -127,9 +130,12 @@ fi'
 # "clean_subdirs" travels down each subdirectory and cleans using make.
 clean_subdirs:
        $(HIDESH) -c '\
-for i in *; do \
-  if [ -d "$$i" ]; then \
-    if [ -f "$$i/$(MAKEFILE_NAME)" -a ! "$$i" -ef `pwd` ]; then \
+for smoot87 in *; do \
+  if [ -d "$$smoot87" ]; then \
+echo "got inside first check of it being dir: $$smoot87"; \
+    if [ -f "$$smoot87/$(MAKEFILE_NAME)" -a ! "$$smoot87" -ef `pwd` ]; then \
+echo "got inside barriers, with filename=$$smoot87 and all conditions met."; \
+echo "the interesting one was: [$(test ! "$$smoot87" -ef `pwd` )]"; \
       (cd "$$i"; $(MAKE) --silent NOT_FIRST_MAKE=t -f $(MAKEFILE_NAME) clean); \
     else \
       echo "Skipping makefile-less directory $$i..."; \
index 1b60dc4d19db9eeb4ac84361ae7cc198301aa843..6acd205616d969ea95c8b3a26b2aeab7b880ca7b 100644 (file)
@@ -187,14 +187,19 @@ include $(PARAMETER_FILE)
 
 ############################################################################
 
-# "CLEAN" is an powerful flag that affects what clam does.  if the flag is
+# "CLEAN" is a powerful flag that affects what clam does.  if the flag is
 # non-empty, then nothing will be built and every generated file that is
-# known about will be deleted.
+# known about will be deleted.  it is intended as exported, since then sub-
+# shells know that they are cleaning and we do not have to pass them a
+# target.
+#hmmm: (although we do?)
 export CLEAN
 # "CLEANUPS" are things to be removed by the "make clean" command.
-#CLEANUPS =
+undefine CLEANUPS
 # OTHER_CLEANS are targets to execute before performing the main clean up.
-#OTHER_CLEANS =
+# we intentionally reset this here to avoid a polluted variable getting
+# to us from a previous make.
+undefine OTHER_CLEANS
 
 # sets the temporary directory.
 export CLAM_TMP