Print this page
cpp: don't handroll an incorrect strtoul(3c), use the one in libc
The previous implementation would parse 0x7ff as 0x755 (etc).


  36 CFLAGS +=       -O2
  37 LD =            $(GCC)
  38 
  39 COMPILE.c =     $(GCC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
  40 LINK.prog =     $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  41 PROTOFILES =    $(DESTDIR)$(PROGDIR)/$(PROG)
  42 
  43 all: $(PROG)
  44 
  45 install: $(PROTOFILES)
  46 
  47 clean:
  48         -rm -f $(OBJS) $(CLEANFILES) $(PROG) *strap
  49 
  50 $(PROG): $(OBJS)
  51         $(LINK.prog)
  52 
  53 %.o$(STRAP): %.c
  54         $(COMPILE.c)
  55 


  56 #
  57 # We need to distinguish between the cpp build in the bootstrap and the cpp
  58 # built normally. However, when we install it, they need to have the same name.
  59 # To handle this we add a small bit of shell logic. Note that the mv bit is
  60 # explicitly ignored and instead we do a final check to make sure we have
  61 # something called cpp at the very end which will either be because of install
  62 # or because of the later mv.
  63 #
  64 $(DESTDIR)$(PROGDIR)/%: %
  65         mkdir -p $(DESTDIR)$(PROGDIR)
  66         /usr/sbin/install -m 0755 -f $(DESTDIR)$(PROGDIR) $(PROG)
  67         -[ "$(PROG)" == "cppstrap" ] && mv -f $(DESTDIR)$(PROGDIR)/$(PROG) \
  68             $(DESTDIR)$(PROGDIR)/cpp
  69         [ -f "$(DESTDIR)$(PROGDIR)/cpp" ]
  70 
  71 y.tab.c: cpy.y
  72         $(YACC) cpy.y


  36 CFLAGS +=       -O2
  37 LD =            $(GCC)
  38 
  39 COMPILE.c =     $(GCC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
  40 LINK.prog =     $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  41 PROTOFILES =    $(DESTDIR)$(PROGDIR)/$(PROG)
  42 
  43 all: $(PROG)
  44 
  45 install: $(PROTOFILES)
  46 
  47 clean:
  48         -rm -f $(OBJS) $(CLEANFILES) $(PROG) *strap
  49 
  50 $(PROG): $(OBJS)
  51         $(LINK.prog)
  52 
  53 %.o$(STRAP): %.c
  54         $(COMPILE.c)
  55 
  56 y.tab.o$(STRAP): yylex.c
  57 
  58 #
  59 # We need to distinguish between the cpp build in the bootstrap and the cpp
  60 # built normally. However, when we install it, they need to have the same name.
  61 # To handle this we add a small bit of shell logic. Note that the mv bit is
  62 # explicitly ignored and instead we do a final check to make sure we have
  63 # something called cpp at the very end which will either be because of install
  64 # or because of the later mv.
  65 #
  66 $(DESTDIR)$(PROGDIR)/%: %
  67         mkdir -p $(DESTDIR)$(PROGDIR)
  68         /usr/sbin/install -m 0755 -f $(DESTDIR)$(PROGDIR) $(PROG)
  69         -[ "$(PROG)" == "cppstrap" ] && mv -f $(DESTDIR)$(PROGDIR)/$(PROG) \
  70             $(DESTDIR)$(PROGDIR)/cpp
  71         [ -f "$(DESTDIR)$(PROGDIR)/cpp" ]
  72 
  73 y.tab.c: cpy.y
  74         $(YACC) cpy.y