Rework generating of files so that every generation tool will only run once.
[dragonfly.git] / gnu / usr.bin / cc41 / cc_tools / gengtype / Makefile
1 # $DragonFly: src/gnu/usr.bin/cc41/cc_tools/gengtype/Makefile,v 1.2 2007/08/25 15:29:29 corecode Exp $
2
3 .include "../Makefile.inc"
4
5 PROG=   gengtype
6 SRCS=   gengtype.c gtyp-gen.h gengtype-lex.l gengtype-yacc.y
7 SRCS+=  ${ERRORS_SRCS}
8
9 CLEANFILES+=    gtyp-gen.h
10
11 gtyp-gen.h: Makefile ../../Makefile.langs ${GTFILES}
12         echo "/* This file is machine generated.  Do not edit.  */" > gtyp-gen.h
13         echo "static const char *const srcdir = "  >> gtyp-gen.h
14         echo "\"$(GTFILES_SRCDIR)\"" >> gtyp-gen.h
15         echo ";" >> gtyp-gen.h
16         echo "static const char *const lang_files[] = {" >> gtyp-gen.h
17 .for gtyp in ${GTFILES_FILES_FILES}
18         echo "\"${gtyp}\", " >> gtyp-gen.h
19 .endfor
20         echo "NULL};" >> gtyp-gen.h
21         echo "static const char *const langs_for_lang_files[] = {" >> gtyp-gen.h
22 .for gtyp in ${GTFILES_FILES_LANGS}
23         echo "\"${gtyp}\", " >> gtyp-gen.h
24 .endfor
25         echo "NULL};" >> gtyp-gen.h
26         echo "static const char *const all_files[] = {" >> gtyp-gen.h
27 .for gtyp in ${GTFILES}
28         echo "\"${gtyp}\", " >> gtyp-gen.h
29 .endfor
30         echo " NULL};" >> gtyp-gen.h
31         echo "static const char *const lang_dir_names[] = { \"c\", " >> gtyp-gen.h
32 .for gtyp in ${GTFILES_LANG_DIR_NAMES}
33         echo "\"${gtyp}\", " >> gtyp-gen.h
34 .endfor
35         echo "NULL};" >> gtyp-gen.h
36
37 all: ${TOOLGENDIR}/gtype-stamp
38
39 ${TOOLGENDIR}/gtype-stamp: ${PROG}.nx
40         cd ${TOOLGENDIR} && ${.OBJDIR}/${PROG}.nx
41         touch ${.TARGET}
42
43 .include <bsd.hostprog.mk>