

#CXX := CC -xarch=v8plusb
#CC := cc -xarch=v8plusb

#CXX := CC -xarch=v9b
#CC := cc -xarch=v9b

CXX := g++
CC := gcc

#CXX := cxx -nocompress
#CC := cc 


OBJCOPY = objcopy


.PHONEY: clean all ctests cxxtests test1 test2 test3 test4


all: test1 test2 test3 test4

cxxtests: test1 test2

ctests: test3 test4


test1:
	@echo 
	@echo Running test 1 : C++ without using objcopy
	${CXX} -c a.cxx	
	${CXX} a.o -o test_cxx_nocopy
	@echo 
	./test_cxx_nocopy
	@echo
	@echo Test completed
	@echo


test2:
	@echo 
	@echo Running test 2 : C++ with using objcopy
	${CXX} -c a.cxx	
	${OBJCOPY} a.o aa.o
	${CXX} aa.o -o test_cxx_withcopy
	@echo 
	./test_cxx_withcopy
	@echo
	@echo Test completed
	@echo



test3:
	@echo
	@echo Running test 3 : C without using objcopy
	${CC} -c c.c
	${CC} c.o -o test_c_nocopy
	@echo 
	./test_c_nocopy
	@echo
	@echo Test completed
	@echo


test4:
	@echo 
	@echo Running test 4 : C with using objcopy
	${CC} -c c.c
	${OBJCOPY} c.o cc.o
	${CC} cc.o -o test_c_withcopy
	@echo 
	./test_c_withcopy
	@echo
	@echo Test completed
	@echo



clean:
	rm -f *.o
	rm -f test_c_*
	rm -f test_cxx_*
