From: Uwe Hermann Date: Wed, 18 Jul 2012 10:16:21 +0000 (+0200) Subject: Support old and new sdcc/sdas8051/asx8051 versions. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.0~18 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d1bee53d988c28311d2b9cc6c43c861c38cce67d;p=sigrok-firmware-fx2lafw.git Support old and new sdcc/sdas8051/asx8051 versions. Tested on Debian with old and new sdcc (2.9.0 and 3.1.0). Testers for Fedora and other distros are welcome! --- diff --git a/fx2lib/lib/Makefile b/fx2lib/lib/Makefile index 1a931808..c8f19d55 100644 --- a/fx2lib/lib/Makefile +++ b/fx2lib/lib/Makefile @@ -20,16 +20,30 @@ INCLUDES = -I../include SDCC = sdcc -mmcs51 $(SDCCFLAGS) LIBS = fx2.lib +# The sdcc 8051 assembler binary has/had different names. +ifneq ($(shell which sdas8051),) +# Newer sdcc, Debian / Ubuntu +SDAS8051 = sdas8051 +endif +ifneq ($(shell which sdcc-sdas8051),) +# Newer sdcc, Fedora +SDAS8051 = sdcc-sdas8051 +endif +ifneq ($(shell which asx8051),) +# Older sdcc +SDAS8051 = asx8051 +endif + all: $(LIBS) $(LIBS): $(FX2_OBJS) sdcclib fx2.lib $? usbav.rel: usbav.a51 - sdas8051 -logs usbav.a51 + $(SDAS8051) -logs usbav.a51 int4av.rel: int4av.a51 - sdas8051 -logs int4av.a51 + $(SDAS8051) -logs int4av.a51 %.rel: %.c $(SDCC) $(INCLUDES) -c $< -o $@ diff --git a/fx2lib/lib/fx2.mk b/fx2lib/lib/fx2.mk index eecedc5c..9e544183 100644 --- a/fx2lib/lib/fx2.mk +++ b/fx2lib/lib/fx2.mk @@ -35,6 +35,20 @@ # # +# The sdcc 8051 assembler binary has/had different names. +ifneq ($(shell which sdas8051),) +# Newer sdcc, Debian / Ubuntu +SDAS8051 = sdas8051 +endif +ifneq ($(shell which sdcc-sdas8051),) +# Newer sdcc, Fedora +SDAS8051 = sdcc-sdas8051 +endif +ifneq ($(shell which asx8051),) +# Older sdcc +SDAS8051 = asx8051 +endif + VID?=0x04b4 PID?=0x8613 @@ -78,7 +92,7 @@ $(BUILDDIR)/$(BASENAME).ihx: $(BUILDDIR) $(SOURCES) $(A51_SOURCES) $(FX2LIBDIR)/ # to differentiate the dependency. (Is it %.rel: %.c or %.a51) for a in $(A51_SOURCES); do \ cp $$a $(BUILDDIR)/; \ - cd $(BUILDDIR) && sdas8051 -logs `basename $$a` && cd ..; done + cd $(BUILDDIR) && $(SDAS8051) -logs `basename $$a` && cd ..; done for s in $(SOURCES); do \ THISREL=$$(basename `echo "$$s" | sed -e 's/\.c$$/\.rel/'`); \ $(CC) -c -I $(FX2LIBDIR)/include $$s -o $(BUILDDIR)/$$THISREL ; done