# Makefile

TARGETS:=simple extern
################################################################################

CXX=$(HOME)/gcc/inst/bin/g++
# do _not_ use -O1 or more here, its bad for the real check.
CXXFLAGS:=-O0 -std=gnu++0x -Wall -Wextra $(CXXFLAGS)

################################################################################

all: $(TARGETS)

simple: use1.o use2.o xvec.hpp use1.hpp use2.hpp amain.o
	$(CXX) $(CXXFLAGS) -o simple use1.o use2.o amain.o

extern: euse1.o euse2.o xvec.hpp use1.hpp use2.hpp emain.o
	$(CXX) $(CXXFLAGS) -o extern euse1.o euse2.o emain.o

check: simple extern
	@echo ""
	@echo "=== normal objects ==="
	nm -A use*.o amain.o | c++filt | grep aprint
	@echo "--- normal executable ---"
	nm -A simple | c++filt | grep aprint
	@echo "--- 'amain' might contain aprint<long> twice -- if not, it could be smart GCC+ELF;"
	@echo "--- but there will be no 'U'ndefined in *.o"
	@echo ""
	@echo "=== extern template objects ==="
	nm -A euse*.o emain.o | c++filt | grep aprint
	@echo "--- extern template executable ---"
	nm -A extern | c++filt | grep aprint
	@echo "--- 'emain' must not have aprint<long> twice;"
	@echo "--- the 'euse*.o' probably have 'U'ndefineds, and 'emain.o' has them 'W'eak defined or such like"
	@echo ""

clean:
	rm -f *.o $(TARGETS) index.html

.PHONY: index.html
