Makefile.rules
247c2b65
 #
 # $Id$
 #
 #
 # common Makefile rules, included by main Makefile & the  modules
 #
 
 #
b2dec9c6
 # Uses: NAME, ALLDEP, CC, CFLAGS, DEFS, LIBS, MKDEP, auto_gen, depends, objs,
 # extra_objs, static_modules, static_modules_path
247c2b65
 # (all this must  be defined previously!,  see Makefile.defs & Makefile)
 #
 
 
 
 #implicit rules
04bb7a49
 %.o:%.c  $(ALLDEP)
247c2b65
 	$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
 
 %.d: %.c $(ALLDEP)
e61f4ba3
 	@set -e; $(MKDEP) $(DEFS) $< \
debad23c
 	|  sed 's#\(\($*D)\)\?$(*F)\)\.o[ :]*#$*.o $@ : #g' > $@; \
247c2b65
 	[ -s $@ ] || rm -f $@
 
 
 # normal rules
dcb5f364
 $(NAME): $(objs) $(ALLDEP)
404073d3
 	$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(LIBS) -o $(NAME) 
247c2b65
 
 
 .PHONY: all
 all: $(NAME) modules
 
 .PHONY: dep
 dep: $(depends)
 
404073d3
 .PHONY: static
 static: $(objs)
 
247c2b65
 .PHONY: clean
054cb6cf
 clean: 
e22bbdb8
 	-@rm -f $(objs) $(NAME) $(objs:.o=.il) 2>/dev/null
e7a9bd30
 	-@for r in $(modules) $(static_modules_path) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo "module $$r" ; \
 			$(MAKE) -C $$r clean ; \
 		fi ; \
b2dec9c6
 	done
054cb6cf
 	@if [ -n "$(modules)" ]; then cd utils/gen_ha1; $(MAKE) clean; fi
247c2b65
 
 .PHONY: proper
 .PHONY: distclean
 .PHONY: realclean
 proper realclean distclean: clean 
74121cdb
 	-@rm -f $(depends) $(auto_gen) 2>/dev/null
e7a9bd30
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			 $(MAKE) -C $$r proper ; \
 		fi ; \
 	done 
247c2b65
 
 .PHONY: mantainer-cleaan
 mantainer-clean: distclean
74121cdb
 	-rm -f TAGS tags *.dbg .*.swp
e7a9bd30
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			$(MAKE) -C $$r mantainer-clean; \
 		fi ; \
 	 done 
 
247c2b65
 
 .PHONY: TAGS
 TAGS:
 	$(MKTAGS) 
 	
04bb7a49
 ifeq (,$(MAKECMDGOALS))
 include $(depends)
 endif
247c2b65
 ifneq (,$(filter-out clean proper distclean realclean mantainer-clean TAGS \
d4f2d8b0
 		tar modules, $(MAKECMDGOALS)))
247c2b65
 include $(depends)
 endif