make: Header generation targets-tools.mk -> include.mk

Move project header generation mechanics from targets-tools.mk into
include.mk.
This commit is contained in:
Jan Lindemann 2009-06-06 15:15:58 +00:00 committed by Jan Lindemann
commit 42851f44b8
2 changed files with 21 additions and 18 deletions

View file

@ -1,10 +1,28 @@
include $(MODDIR)/make/defs.mk
include $(MODDIR)/make/rules.mk
all:
# variables
#PROJ_H ?= $(PROJECT).h
SRC_H += $(PROJ_H)
# mandatory targets
all: $(PROJ_H)
clean: clean.include
install: install_HDR
clean.include:
rm -rf *.h *~ .*.swp *.done
# convenience targets
project-header: $(PROJ_H)
# rules
clean.include:
rm -rf *.h *~ .*.swp *.done $(PROJ_H)
$(PROJ_H): $(filter-out $(PROJ_H) $(PROJECT)/$(PROJ_H),$(wildcard *.h $(PROJECT)/*.h))
echo "#ifndef _$(PROJECT_CAPNAME)_H" > $@.tmp
echo "#define _$(PROJECT_CAPNAME)_H" >> $@.tmp
echo >> $@.tmp
for h in $(sort $(patsubst $(PROJECT)/%,%,$^)); do echo "#include <$(PROJECT)/$$h>"; done >> $@.tmp
echo >> $@.tmp
echo "#endif /* #ifndef _$(PROJECT_CAPNAME)_H */" >> $@.tmp
mv $@.tmp $@