# # # PRJDIR = .. include $(PRJDIR)/Makefile.common PORTS = mcs51 z80 avr ds390 PORT_LIBS = $(PORTS:%=%/port.a) LIBS = -lgc -lm @LIBS@ ifeq ($(HAVE_LIBGC), 1) else LIBDIRS = -L$(PRJDIR)/support/gc LIBGC = $(PRJDIR)/support/gc/libgc.a endif ifdef SDCC_SUB_VERSION CFLAGS += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\" endif OBJECTS = SDCCy.o SDCClex.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 \ asm.o SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) TARGET = $(PRJDIR)/bin/sdcc # Compiling entire program or any subproject # ------------------------------------------ all: ports checkconf $(LIBGC) $(TARGET) ports: for i in $(PORTS); do $(MAKE) -C $$i; done $(PRJDIR)/support/gc/libgc.a: cd $(PRJDIR)/support/gc && $(MAKE) # Compiling and installing everything and runing test # --------------------------------------------------- install: all installdirs $(INSTALL) -s $(TARGET) $(bindir)/sdcc # Deleting all the installed files # -------------------------------- uninstall: rm -f $(bindir)/sdcc # Performing self-test # -------------------- check: # Performing installation test # ---------------------------- installcheck: # Creating installation directories # --------------------------------- installdirs: $(INSTALL) -d $(bindir) # Creating dependencies # --------------------- dep: Makefile.dep Makefile.dep: $(SOURCES) *.h $(PRJDIR)/*.h $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep include Makefile.dep include clean.mk # My rules # -------- $(TARGET): $(OBJECTS) $(PORT_LIBS) $(CC) -o $@ $(OBJECTS) $(PORT_LIBS) $(LIBDIRS) $(LIBS) .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ SDCCy.h: SDCCy.c SDCCy.c: SDCC.y $(YACC) -d -v -o $@ $< SDCClex.c: SDCC.lex SDCCy.h $(LEX) -t $< >$@ .y.c: rm -f $*.cc $*.h $(YACC) -d $< mv y.tab.c $*.cc mv y.tab.h $*.h .l.c: rm -f $*.cc $(LEX) -t $< >$*.cc # Remaking configuration # ---------------------- checkconf: @if [ -f $(PRJDIR)/devel ]; then\ $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \ freshconf;\ fi # End of main_in.mk/main.mk