Makefile from Linux doesn't work on BSD; what is the $^ symbol?

caesius

Well-Known Member

Reaction score: 19
Messages: 280

[SOLVED] - just had to run gmake... I guess make is aliased to gmake on linux systems...

I'm trying to build something at home that's meant to be built on the university computers running Fedora Core.

When I try to make, I get the following error:
Code:
> make
avr-gcc -c -mmcu=atmega8 -Os -Wall -Wstrict-prototypes -W -g bounce1.c -o bounce1.o
avr-gcc -c -mmcu=atmega8 -Os -Wall -Wstrict-prototypes -W -g pacer.c -o pacer.o
avr-gcc -c -mmcu=atmega8 -Os -Wall -Wstrict-prototypes -W -g pio.c -o pio.o
avr-gcc -mmcu=atmega8 -Os -Wall -Wstrict-prototypes -W -g  -o bounce1.out
avr-gcc: no input files
*** Error code 1

Stop in /usr/home/ben/Desktop/enel206_asmt2/enel206-16/ass3lab1/bounce1.
>
Here's the makefile

Code:
# File:   Makefile
# Author: M. P. Hayes, UCECE
# Date:   20 August 2007
# Descr:  Makefile for bounce1

CC = avr-gcc
CFLAGS = -mmcu=atmega8 -Os -Wall -Wstrict-prototypes -W -g

OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm

# Default target.
all: bounce1.hex


# Compile: create object files from C source files.
bounce1.o: bounce1.c pacer.h pio.h config.h target.h
	$(CC) -c $(CFLAGS) bounce1.c -o bounce1.o

pio.o: pio.c pio.h config.h target.h
	$(CC) -c $(CFLAGS) pio.c -o pio.o

pacer.o: pacer.c pacer.h config.h target.h
	$(CC) -c $(CFLAGS) pacer.c -o pacer.o


# Link: create ELF output file from object files.
bounce1.out: bounce1.o pacer.o pio.o
	$(CC) $(CFLAGS) $^ -o $@
	$(SIZE) bounce1.out


# Create hex output file from ELF output file.
bounce1.hex: bounce1.out
	$(OBJCOPY) -O ihex bounce1.out bounce1.hex


# Target: clean project.
.PHONY: clean
clean: 
	-$(DEL) *.o *.out *.hex

.PHONY: realclean
realclean: clean
	-$(DEL) *~ *.bak


# Target: program project.
.PHONY: program
program: bounce1.hex
	cp $^ /tmp/
	bootloadHID -r /tmp/$^
	$(DEL) /tmp/$^
From what I can see, it's the $^ symbol that's the problem. How can I make this makefile behave under FreeBSD?

Cheers
 

fonz

Son of Beastie

Reaction score: 369
Messages: 2,560

caesius said:
I guess make is aliased to gmake on linux systems...
Actually, make is gmake on Linux systems:
  • It's called "GNU Make" in full.
  • It's the default make on Linux systems, so it's simply called make there.
  • It's called gmake on FreeBSD systems to distinguish it from FreeBSD's default make, which is (as you probably guessed) simply called make(1) and which (as you just found out) is a different kind of make.

Alphons
 
Top