-1

I have a make file that works just fine on this version of Linux. HOWEVER why doesn't it run on this other version...

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
codename :      trusty

right here... it doesn't run on this one? why?

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

I get this error on xenial...why?

Ubuntu mate $:make
gcc: error: missing filename after ‘-o’
gcc: fatal error: no input files
compilation terminated.

Here is my make file ( updated, last post did not have this )

CFLAGS = gcc -g
OBJ = dummyDriverX1.o x1.o error.o

# Automatic substitution using suffix rules to
%.o: %.c
    ${CFLAGS} -c $< 

%.o: %.cpp
    ${CFLAGS} -c $<

# Building x1 based on the required .o files
pell: ${OBJ}
    ${CFLAGS} -o pell ${OBJ}

clean:
    rm ${OBJ}
humbleSquid
  • 57
  • 2
  • 8
  • 2
    Show the makefile. – Barmar Nov 17 '17 at 20:45
  • 2
    The version of Linux is not relevant, what matters is the version of `make`. – Barmar Nov 17 '17 at 20:51
  • 1
    the makefile might depend on other scripts that has issues. – Jason Hu Nov 17 '17 at 20:54
  • Not sure if this has any value but when I call for make -v ( so that I may see the version, as according to the man pages) I get a gcc: fatal error: no input files compliation terminated. – humbleSquid Nov 20 '17 at 02:48
  • Are you sure that this is the complete and unchanged makefile on both machines? It looks like in one version `$(OBJ)` is never assigned a value and therefore make tries to compile in the recipe of `pell` instead of linking. Moreover the output can't be from exactly this rule, as I see no `gcc -g ...` after starting make. – Vroomfondel Nov 20 '17 at 07:11
  • Yup, this is what it looks like. OBJ is assigned at the top. Starting to think that maybe I should uninstall make then reinstall it. – humbleSquid Nov 20 '17 at 17:12
  • 1
    Your `Makefile` is really wrong. See [this](https://stackoverflow.com/a/16751650/841108) example; remove your `Makefile`, run `make -p` to understand the builtin rules, and write your new `Makefile` correctly. – Basile Starynkevitch Nov 20 '17 at 18:32

1 Answers1

0

Your Makefile replaces make's good built-in default rules with inferior homegrown cargo cult guesswork. Make knows exactly how to compile a C file with the correct flags and options for your compiler; don't try to outsmart it, especially if you aren't familiar with the compiler. (So, not properly a make problem per se; but letting make use its default will fix your incorrect compiler invocation.)

tripleee
  • 175,061
  • 34
  • 275
  • 318