Makefile error

compile all .c files in the directory into .o files.
execute makefile error: make: * No destination. Stop it.

C
Mar.04,2021

you don't need -o

if you just generate the target file.
*.o: *.c
    gcc -c $^

error in the above code

src=$(wildcard *.c)
obj=$(patsubst %.c,%.o,$(src))
$obj: $(src)
    gcc -c $(src)

then make


compile the c file in the directory to the corresponding object file

sources = $(wildcard *.c)
objects = $(patsubst %.c,%.o,$(sources))
$(objects) : %.o : %.c
    gcc -c $<
    
all: $(objects)

it is recommended that you take a look at makefile's static mode rules .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bfada3-32240.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bfada3-32240.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?