Replace Perl version of packihx with C version
[fw/sdcc] / src / Makefile.in
index ea00049df062ab142ffb88d673c2f140848d57e2..ff320931886016891984cef4bfaa1fdfdd411721 100644 (file)
@@ -6,24 +6,46 @@ PRJDIR                = ..
 
 include $(PRJDIR)/Makefile.common
 
-PORTS          = mcs51
+USE_ALT_LEX    = 0
+
+PORTS          = mcs51 z80 avr ds390
 PORT_LIBS      = $(PORTS:%=%/port.a)
 
-LIBS           = -lgc @LIBS@
+LIBS           = -lgc -lm @LIBS@
+ifeq ($(HAVE_LIBGC), 1)
+else
 LIBDIRS                = -L$(PRJDIR)/support/gc
+LIBGC          = $(PRJDIR)/support/gc/libgc.a
+endif
+
+#CFLAGS          += -Werror
+
+ifdef SDCC_SUB_VERSION
+CFLAGS         += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
+endif
 
-OBJECTS        = SDCCy.o SDCClex.o SDCCerr.o SDCChasht.o SDCCmain.o \
+OBJECTS        = SDCCy.o SDCCerr.o SDCChasht.o SDCCmain.o \
                  SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
                  SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o \
                  SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o \
-                 SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o spawn.o
+                 SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o spawn.o \
+                 asm.o
+
+SPECIAL                = SDCCy.h 
+ifeq ($(USE_ALT_LEX), 1)
+OBJECTS                += altlex.o
+SPECIAL                += reswords.h
+else
+OBJECTS                += SDCClex.o
+endif
+
 SOURCES                = $(patsubst %.o,%.c,$(OBJECTS))
 
 TARGET         = $(PRJDIR)/bin/sdcc
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: ports checkconf $(PRJDIR)/support/gc/libgc.a $(TARGET)
+all: ports checkconf $(LIBGC) $(TARGET)
 
 ports:
        for i in $(PORTS); do $(MAKE) -C $$i; done
@@ -31,7 +53,6 @@ ports:
 $(PRJDIR)/support/gc/libgc.a:
        cd $(PRJDIR)/support/gc && $(MAKE)
 
-
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
 install: all installdirs
@@ -42,7 +63,7 @@ install: all installdirs
 # --------------------------------
 uninstall:
        rm -f $(bindir)/sdcc
-
+       rm -f $(bindir)/packihx
 
 # Performing self-test
 # --------------------
@@ -64,7 +85,7 @@ installdirs:
 # ---------------------
 dep: Makefile.dep
 
-Makefile.dep: $(SOURCES) *.h $(PRJDIR)/*.h
+Makefile.dep: $(SOURCES) $(SPECIAL) *.h $(PRJDIR)/*.h
        $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep
 
 include Makefile.dep
@@ -79,6 +100,11 @@ $(TARGET): $(OBJECTS) $(PORT_LIBS)
 .c.o:
        $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
 
+reswords.h: reswords.gperf Makefile
+       gperf -o -k1,2,4 -t -C -N is_reserved_word $< > $@
+
+altlex.o: altlex.c SDCCy.h reswords.h
+
 SDCCy.h: SDCCy.c
 
 SDCCy.c: SDCC.y
@@ -87,9 +113,6 @@ SDCCy.c: SDCC.y
 SDCClex.c: SDCC.lex SDCCy.h
        $(LEX) -t $< >$@
 
-SDCCpeeph.rul: SDCCpeeph.def
-       $(AWK) -f SDCCpeeph.awk SDCCpeeph.def > SDCCpeeph.rul
-
 .y.c:
        rm -f $*.cc $*.h
        $(YACC) -d $<