nawk-20121220-parallel-build.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --- makefile.orig 2013-02-06 10:26:36.452829647 -0700
  2. +++ makefile 2013-02-07 09:12:13.293898947 -0700
  3. @@ -44,7 +44,7 @@
  4. LISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \
  5. lib.c run.c tran.c
  6. -SHIP = README FIXES $(SOURCE) ytab[ch].bak makefile \
  7. +SHIP = README FIXES $(SOURCE) makefile \
  8. awk.1
  9. a.out: ytab.o $(OFILES)
  10. @@ -52,11 +52,15 @@
  11. $(OFILES): awk.h ytab.h proto.h
  12. -ytab.o: awk.h proto.h awkgram.y
  13. +#Clear dependency for parallel build: (make -j)
  14. +#YACC generated y.tab.c and y.tab.h at the same time
  15. +#this needs to be a static pattern rules otherwise multiple target
  16. +#are mapped onto multiple executions of yacc, which overwrite
  17. +#each others outputs.
  18. +y%.c y%.h: awk.h proto.h awkgram.y
  19. $(YACC) $(YFLAGS) awkgram.y
  20. - mv y.tab.c ytab.c
  21. - mv y.tab.h ytab.h
  22. - $(CC) $(CFLAGS) -c ytab.c
  23. + mv y.$*.c y$*.c
  24. + mv y.$*.h y$*.h
  25. proctab.c: maketab
  26. ./maketab >proctab.c
  27. @@ -64,23 +68,23 @@
  28. maketab: ytab.h maketab.c
  29. $(CC) $(CFLAGS) maketab.c -o maketab
  30. -bundle:
  31. +bundle: $(SHIP)
  32. @cp ytab.h ytabh.bak
  33. @cp ytab.c ytabc.bak
  34. - @bundle $(SHIP)
  35. + @bundle $(SHIP) ytabh.bak ytabc.bak
  36. -tar:
  37. +tar: $(SHIP)
  38. @cp ytab.h ytabh.bak
  39. @cp ytab.c ytabc.bak
  40. @bundle $(SHIP) >awk.shar
  41. - @tar cf awk.tar $(SHIP)
  42. + @tar cf awk.tar $(SHIP) ytabh.bak ytabc.bak
  43. gzip awk.tar
  44. ls -l awk.tar.gz
  45. - @zip awk.zip $(SHIP)
  46. + @zip awk.zip $(SHIP) ytabh.bak ytabc.bak
  47. ls -l awk.zip
  48. names:
  49. @echo $(LISTING)
  50. clean:
  51. - rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda # proctab.c
  52. + rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda ytab.c ytab.h # proctab.c