Response to test/Makefile comments for damiano make-cleanup
authorKrista Bennett <>
Fri, 21 Dec 2018 11:14:10 +0100
changeset 3200329005a93c6a
parent 3199 e16d89af41ad
child 3201 105b50dfaf15
Response to test/Makefile comments for damiano
     1.1 --- a/test/Makefile	Thu Dec 20 21:47:52 2018 +0100
     1.2 +++ b/test/Makefile	Fri Dec 21 11:14:10 2018 +0100
     1.3 @@ -6,11 +6,14 @@
     1.5  include ../default.conf
     1.7 -# I tend to not use spacing around assignment operators in Make. Sometimes weird things happen.
     1.8 -# Also -- this is very much a matter of taste -- my python scripts all have '#!/usr/bin/env python3' as the first line, and it's the user's job for there to always be an appropriate python3. I wouldn't add any business logic in the makefile regarding finding the python interpreter, if I just run my own python scripts.
     1.9 -PY_ENV := $(shell command -v python3 2> /dev/null)
    1.10 +# This is done this way because we presume that users who don't have python3 installed are also not bothering with the generated parts of the test suite (i.e. non-devs).
    1.11 +# Tests will totally build and run without it.
    1.12 +PY_ENV:=$(shell command -v python3 2> /dev/null)
    1.14  # Since you 'include' before evaluating CURDIR, I think it's possible that CURDIR does not have the value you think it might have. Yes, make is awkward.
    1.15 +# KB: These are probably redundant anyway. But it is supposed to correspond to the directory in src/, which is whatever the cwd is that TestDriver is running in.
    1.16 +#     It's a pretty trivial point anyway - it's only used in the clean target, and only really matters if tests were interrupted because of a seg fault or non-test assert;
    1.17 +#     in that case, the test directory not being cleaned up *might* be problematic, but really probably isn't.
    1.18  HERE:=$(CURDIR)
    1.19  TEST_HOME=$(HERE)/pEp_test_home
    1.21 @@ -21,22 +24,26 @@
    1.22  DEPS := $(OBJS:.o=.d)
    1.24  # Using '/usr/local/include' is very much a "works on my machine" solution to the problem. Either, the compiler search paths are enough, otherwise define a BLA_INC and BLA_LIB path to make clear to other developers what you are looking for outside the standard paths.
    1.25 +# KB: Sure. Then fix that - again, audience of 1-4, and we needed to make our tests work. This file tends to get hacked when settings from above don't end up in compilation.
    1.26  INC_DIRS := ./include /usr/local/include ../src ../sync ../asn.1
    1.27  # Whoa dude... addprefix is brilliant. Why didn't I find this before!? This could make setting all the *_INC and *_LIB so much nicer!
    1.28  INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC) $(CPPUNIT_INC)
    1.30  # '+=' is a magic assignment operators. It ensures that there is exactly one space between the old value and the suffix. Yes, this means it might strip spaces. At any rate, there is no need to add a space after the operator.
    1.31 -LDFLAGS += -L/usr/local/lib
    1.32 +# KB: I doubt this was in any way intentional.
    1.33 +LDFLAGS+=-L/usr/local/lib
    1.35  # For setting both C and C++ compiler flags, there is CPPFLAGS
    1.36 -CFLAGS += -Wno-deprecated
    1.37 -CXXFLAGS += -Wno-deprecated
    1.38 +# KB: This was almost certainly desperation because something wasn't working as it should. 
    1.39 +CFLAGS+=-Wno-deprecated
    1.40 +CXXFLAGS+=-Wno-deprecated
    1.41  CFLAGS:=$(filter-out -Wall,$(CFLAGS))
    1.43  LDFLAGS+= $(ETPAN_LIB) $(CPPUNIT_LIB) -L../asn.1 -L../src
    1.44  LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
    1.46  # Caution: you're using tab to indent here, but none of the lines from here to 60 are recipes. Indentation should be done with spaces. This only works because Make is such a gratious tool. (Yeah, right...)
    1.47 +# KB: Feel free to change it.
    1.48  ifeq ($(BUILD_FOR),Linux)
    1.49  	LDLIBS+= -luuid
    1.50  endif
    1.51 @@ -54,6 +61,9 @@
    1.52  endif
    1.54  # Looks like both LIBPATH and LLDB_BIN aren't needed any more.
    1.55 +# KB: I don't know. Building on MacOS is tetchy, so if it works without it, feel free to remove it.
    1.56 +#     But if you break Volker, prepare to hear about it :) Of all the Makefiles to be careful about optimising,
    1.57 +#     this one is the worst, because it's the ones devs need to "just work" at all times.
    1.58  ifeq ($(shell uname),Darwin)
    1.60  	LLDB_BIN=/Applications/
    1.61 @@ -67,6 +77,7 @@
    1.62  # Probably everything from here to 81 is not needed any more either...
    1.63  # Create a list of the extra library paths for the loader. I do not assume that the engine (and its dependencies) are installed for testing.
    1.64  # Note that += can not be used here, as it changes the amount of whitespace
    1.65 +# KB: See above.
    1.66  EXTRA_LIB_PATHS=../src:
    1.67  ifdef ETPAN_LIB
    1.68  	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
    1.69 @@ -98,9 +109,13 @@
    1.70  CPPFLAGS += $(INC_FLAGS) -MMD -MP
    1.72  # Forgot the phony for all?
    1.73 +# KB: I have no idea. Again, was just making it work. I bow to the master ;)
    1.74  all: suitemaker $(TARGET) test_home_ scripts
    1.76  # There is probably a built-in rules that makes this redundant. Unless we're not using '.cc' or 'CPPFLAGS' as is canon in GNU Make land.
    1.77 +# KB: NOPE. This had to be readded because the built-in rules did NOT use them. Leave it unless you can fix that. I didn't have time to
    1.78 +#     investigate why not, I needed the tests to run with the right flags.
    1.79 +#     You can do what you want here, as long as I get all the flags I expect to see :)
    1.80  %.o:
    1.81  	$(CXX) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    1.83 @@ -126,6 +141,7 @@
    1.86  # So, if there is no python, then 'scripts' will trivially be up to date, because there is no recipe associated with this rule. That's probably not what you want.
    1.87 +# KB: That is totally what I want here.
    1.88  .PHONY: scripts
    1.89  scripts: 
    1.90  ifdef PY_ENV
    1.91 @@ -133,6 +149,7 @@
    1.92  endif
    1.94  # Ah, yes, here it is. Finally someone tripped over me introducing both Makefile.conf and default.conf. TEST_DEBUGGER is documented in one, but not the other Makefile. Yeah, I should clean this up, otherwise every time a new knob is added, it will only appear in either Makefile.conf or default.conf.
    1.95 +# KB: Discuss with Volker and/or Neal. I don't use the TEST_DEBUGGER thing.
    1.96  .PHONY: test
    1.97  test: all
    1.98  	$(TEST_DEBUGGER) ./$(TARGET)
    1.99 @@ -145,5 +162,6 @@
   1.102  # You know, I think we have this "compiler generates Makefiles" pattern in another makefile in the engine, but there it looks completly different. From reading just this makefile: are you sure, the compiler generated Makefiles are actually every generated? You don't have DEPS as a prerequisite anywhere. Is there some built-in rule that has %.d as a prerequisite? Without further investigation I am not convinced the %.d files are ever generated...
   1.103 +# KB: This might be leftover.
   1.104  -include $(DEPS)