Commit 546f8f42 authored by Fred Riss's avatar Fred Riss
Browse files

[lldb/testsuite] Modernize 2 test Makefiles

Those old Makefiles used completely ad-hoc rules for building files,
which means they didn't obey the test harness' variants.

They were somewhat tricky to update as they use very peculiar build
flags for some files. For this reason I was careful to compare the
build commands before and after the change, which is how I found the
discrepancy fixed by the previous commit.

While some of the make syntax used here might not be easy to grasp for
newcomers (per-target variable overrides), it seems better than to
have to repliacte the Makefile.rules logic for the test variants and
platform support.
parent 509b7888
Loading
Loading
Loading
Loading
+15 −26
Original line number Diff line number Diff line
CXX_SOURCES = main.cpp length.cpp a.cpp

CFLAGS_LIMIT = -c $(CXXFLAGS)
CFLAGS_NO_LIMIT = -c $(CXXFLAGS)

ifneq (,$(findstring clang,$(CC)))
  CFLAGS_LIMIT += -flimit-debug-info
  CFLAGS_NO_LIMIT += -fno-limit-debug-info
endif
CXX_SOURCES := length.cpp a.o main.o
EXE := nolimit

all: limit nolimit

limit: main.o length_limit.o a.o
	$(CXX) main.o length_limit.o a.o -o limit $(LDFLAGS)

nolimit: main.o length_nolimit.o a.o
	$(CXX) main.o length_nolimit.o a.o -o nolimit $(LDFLAGS)

main.o: main.cpp
	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/main.cpp -o main.o

length_limit.o: length.cpp
	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/length.cpp -o length_limit.o
include Makefile.rules

length_nolimit.o: length.cpp
	$(CXX) $(CFLAGS_NO_LIMIT) $(SRCDIR)/length.cpp -o length_nolimit.o
# Force a.cpp to be built with no debug inforamtion
a.o: CFLAGS = $(CFLAGS_NO_DEBUG)

a.o: a.cpp
	$(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/a.cpp -o a.o
# The default testsuite setup forces -fno-limit-debug-info. Let's not rely on
# CFLAGS_EXTRAS being passed after the default arguments. This rule makes
# sure the variable used by Makefile.rules for this argument is cleared.
main.o: NO_LIMIT_DEBUG_INFO_FLAGS = ""
main.o: CFLAGS_EXTRAS = -flimit-debug-info

clean: OBJECTS += limit nolimit length_limit.o length_nolimit.o length_limit.dwo length_nolimit.dwo
limit: a.o main.o
	mkdir -p build_limit
	$(MAKE) -C $(BUILDDIR)/build_limit -f $(MAKEFILE_RULES) \
		EXE=../limit CXX_SOURCES="length.cpp ../a.o ../main.o" \
		CFLAGS_EXTRAS=-flimit-debug-info NO_LIMIT_DEBUG_INFO_FLAGS=""
include Makefile.rules
+5 −10
Original line number Diff line number Diff line
CFLAGS := -g -O0
CFLAGS_NO_DEBUG = 
OBJC_SOURCES := myclass.m repro.m
LD_EXTRAS := -framework Foundation

all: aout

aout: 
	$(CC) $(CFLAGS_NO_DEBUG) $(SRCDIR)/myclass.m -c -o myclass.o
	$(CC) $(CFLAGS) myclass.o $(SRCDIR)/repro.m -framework Foundation
include Makefile.rules

clean::
	rm -f myclass.o
# Force myclass.m to be compiled without debug info
myclass.o: CFLAGS = $(CFLAGS_NO_DEBUG)
include Makefile.rules