This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gmake



Hello. I've got a Makefile here, which executes an 'rm' 
command for no reason at the end, after the last 'here' echo. 

Here is output from doing a 'gmake' in the directory. 

touch /swdevl/dogboy/testApp/src/testApp
rm -f /swdevl/dogboy/testApp/src/testApp
here
rm /swdevl/dogboy/private/LINUX/testApp/src/objB.d 
/swdevl/dogboy/private/LINUX/testApp/src/main.d 
/swdevl/dogboy/private/LINUX/testApp/src/objA.d


I haven't told the Makefile to perform the last 'rm'. For some 
reason, it keeps doing it!! If you could look at my Makefile, 
or point me to a forum where this kind of thing could be
answered, I would appreciate it!!

Thanks in advance.
Lucio Flores
lucio_flores_2000@yahoo.com





inc_flags = -I../include
gen_flags = -fhonor-std
CC = g++

EXECS = testApp
testApp_SRCS = main.C objA.C objB.C

##### USER DEFINED SECTION ENDS
##### USER DEFINED SECTION ENDS
##### USER DEFINED SECTION ENDS
##### USER DEFINED SECTION ENDS

############################ DEFINES

cwd = $(shell pwd)
build_top = /swdevl/$(USER)
prv_dir = $(build_top)/private/LINUX
build_dir = $(shell mkPrvBuild $(prv_dir) $(cwd))

all_srcs = $(sort $(foreach exec,$(EXECS),$($(exec)_SRCS)))
all_objs = $(patsubst %,$(build_dir)/%.o,$(basename $(all_srcs)))

CC = g++
cc = gcc
dep_flags = -MM

build_cxx_dep = set -e ; $(CC) $(dep_flags) $($(basename $(notdir $<))_XCXXFLAGS) $< -c > $@.raw


define make_build_dir
	test -d $(dir $@) || mkdir -p $(dir $@)
endef

define fixup_deps
	sed -e 's#^\(.*$*\.o\)[ \t]*:#$(dir $@)\1 $@:#g' \
	  -e 's#:[ \t]*$(notdir $<)#: $<#' -e 's@^/tmp_mnt@@' -e 's@^/export@@'
endef

define do_cxx_depend
	@$(make_build_dir)	
	$(build_cxx_dep)
	@echo made $@.raw
	#$(fixup_deps_a) < $@.raw > $@
	fixDeps $@.raw $@
endef

define touch_exec
	touch $@
	rm -f $@
endef

define dump_vars
	@echo
	@echo VAR LIST
	@echo EXECS $(EXECS)
	@echo cwd $(cwd)
	@echo build_top $(build_top)
	@echo all_srcs $(all_srcs)
	@echo all_objs $(all_objs)
	@echo prv_dir $(prv_dir)
	@echo build_dir $(build_dir)
	@echo
endef
######################### rules

# make an obj from *.C

$(build_dir)/%.d : %.C
	@echo makeDepend $@ from $<
	$(do_cxx_depend)
	@echo makeDepend done

$(build_dir)/%.o : $(build_dir)/%.d
	$(make_build_dir)
	@echo Compiling $<
	$(CC) -c $<


all: $(addprefix $(cwd)/,$(EXECS))

.PHONY: $(addprefix $(cwd)/,$(EXECS))
ifneq ($(strip $(EXECS)),)
$(addprefix $(cwd)/,$(EXECS)) : $(all_objs)
	@echo makeMyexec
	$(dump_vars)
	$(touch_exec)
	@echo here
endif

#
#.PHONY: clean
#clean: 
#	@echo CLEANME
#	-rm -f $(build_dir)/*
#
#
# all the sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]