-1

I'm compiling a 8051 project with SDCC but has a problem with Makefile, the following sources:

TARGET  = test
CC      = sdcc
CFLAGS  = -Wall -I.
RM      = rm -rf
SRCS    = $(wildcard *.c)
RELS    = $(patsubst %.c,%.rel,$(SRCS))

$(TARGET).bin: $(TARGET).hex
        objcopy -I ihex -O binary $< $@

$(TARGET).hex: $(TARGET).ihx
        packihx $< > $@

$(TARGET).ihx: $(RELS)
        @echo Linking ...
        $(CC) $(CFLAGS) $< -o $@
        @echo Build finish!
%.rel: %.c
        @echo Compiling ...
        $(CC) $(CFLAGS) -c $< -o $@

.PHONY: clean
clean:
        @echo Removing ...
        $(RM) *.rel *.ihx *.lk *.lst *.map *.mem *.rst *.sym *.asm $(TARGET)
        @echo Removed!

When I run make it has errors:

minh@PCDESIGN:~/workspaces/programMSC51/test$ make
Compiling ...
sdcc -Wall -I. -c main.c -o main.rel

sdas Assembler V02.00 + NoICE + SDCC mods  (Intel 8051)


Copyright (C) 2012  Alan R. Baldwin
This program comes with ABSOLUTELY NO WARRANTY.

Usage: [-Options] file
Usage: [-Options] outfile file1 [file2 file3 ...]
  -d   Decimal listing
  -q   Octal   listing
  -x   Hex     listing (default)
  -g   Undefined symbols made global
  -a   All user symbols made global
  -b   Display .define substitutions in listing
  -bb  and display without .define substitutions
  -c   Disable instruction cycle count in listing
  -j   Enable NoICE Debug Symbols
  -y   Enable SDCC  Debug Symbols
  -l   Create list   file/outfile[.lst]
  -o   Create object file/outfile[.rel]
  -s   Create symbol file/outfile[.sym]
  -p   Disable automatic listing pagination
  -u   Disable .list/.nlist processing
  -w   Wide listing format for symbol table
  -z   Disable case sensitivity for symbols
  -f   Flag relocatable references by  `   in listing file
  -ff  Flag relocatable references by mode in listing file
  -I   Add the named directory to the include file
       search path.  This option may be used more than once.
       Directories are searched in the order given.

removing
make: *** [Makefile:22: main.rel] Error 1

How can I fix this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

1 Answers1

0

Unlike other compilers, SDCC does not have a -Wall option. You should remove it from CFLAGS = -Wall -I. in the Makefile.

It also does not have a replacement. There are options --less-pedantic and -Werror, which gives you fewer warnings, or treats warnings as errors, respectively, but there is no option for creating more warnings.

The manual mentions --more-pedantic, but

Actually this is not a SDCC compiler option but if you want more warnings you can use a separate tool dedicated to syntax checking [...]

See SDCC Compiler User Guide (version 4.1.12), section 3.3.4.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65