jw-pkg/make/include.mk
Jan Lindemann 42851f44b8 make: Header generation targets-tools.mk -> include.mk
Move project header generation mechanics from targets-tools.mk into
include.mk.
2009-06-06 15:15:58 +00:00

28 lines
714 B
Makefile

include $(MODDIR)/make/defs.mk
include $(MODDIR)/make/rules.mk
# variables
#PROJ_H ?= $(PROJECT).h
SRC_H += $(PROJ_H)
# mandatory targets
all: $(PROJ_H)
clean: clean.include
install: install_HDR
# 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 $@