Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. hostprogs-y := genksyms
  2. always := $(hostprogs-y)
  3. genksyms-objs := genksyms.o parse.o lex.o
  4. # -I needed for generated C source (shipped source)
  5. HOSTCFLAGS_parse.o := -Wno-uninitialized -I$(src)
  6. # dependencies on generated files need to be listed explicitly
  7. $(obj)/lex.o: $(obj)/parse.h $(obj)/keywords.c
  8. # -I needed for generated C source (shipped source)
  9. HOSTCFLAGS_lex.o := -I$(src)
  10. ifdef GENERATE_PARSER
  11. # gperf
  12. quiet_cmd_keywords.c = GPERF $@
  13. cmd_keywords.c = gperf -L ANSI-C -a -C -E -g -H is_reserved_hash \
  14. -k 1,3,$$ -N is_reserved_word -p -t $< > $@
  15. $(obj)/keywords.c: $(obj)/keywords.gperf FORCE
  16. $(call if_changed,keywords.c)
  17. cp $@ $@_shipped
  18. # flex
  19. quiet_cmd_lex.c = FLEX $@
  20. cmd_lex.c = flex -o$@ -d $<
  21. $(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE
  22. $(call if_changed,lex.c)
  23. cp $@ $@_shipped
  24. # bison
  25. quiet_cmd_parse.c = BISON $@
  26. cmd_parse.c = bison -o$@ -dtv $(filter-out FORCE,$^)
  27. $(obj)/parse.c: $(obj)/parse.y FORCE
  28. $(call if_changed,parse.c)
  29. cp $@ $@_shipped
  30. cp $(@:.c=.h) $(@:.c=.h)_shipped
  31. $(obj)/parse.h: $(obj)/parse.c ;
  32. clean-files += parse.output
  33. endif
  34. targets += keywords.c lex.c parse.c parse.h