make yocto compatible
This commit is contained in:
parent
596937a04a
commit
ee26652f4e
@ -1,13 +1,7 @@
|
||||
|
||||
EXECUTABLE = helloworld-c-make
|
||||
|
||||
INSTALL_PREFIX = /usr/local
|
||||
|
||||
CFLAGS = -std=c17 -Wall -Wextra -pedantic -pedantic-errors -O2
|
||||
LFLAGS =
|
||||
|
||||
LD=gcc
|
||||
CC=gcc
|
||||
|
||||
SOURCE_FILES = \
|
||||
src/main.c
|
||||
@ -18,11 +12,8 @@ HEADER_FILES = $(shell find src/ -name *.h)
|
||||
|
||||
all: build/$(EXECUTABLE) build/compile_flags.txt
|
||||
|
||||
install: build/$(EXECUTABLE)
|
||||
cp build/$(EXECUTABLE) $(INSTALL_PREFIX)/bin/$(EXECUTABLE)
|
||||
|
||||
build/$(EXECUTABLE): $(OBJECT_FILES)
|
||||
$(LD) -o $@ $(LFLAGS) $^
|
||||
$(CC) -o $@ $(LDFLAGS) $^
|
||||
|
||||
build/%.o: src/%.c $(HEADER_FILES) build-folder
|
||||
$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@ -31,7 +22,7 @@ build-folder:
|
||||
mkdir -p build/
|
||||
|
||||
clean:
|
||||
$(RM) build/
|
||||
rm -rf build/
|
||||
|
||||
build/compile_flags.txt:
|
||||
echo -xc $(CFLAGS) \
|
||||
|
@ -9,9 +9,7 @@ make
|
||||
```
|
||||
make
|
||||
|
||||
sudo make install
|
||||
# or
|
||||
sudo make INSTALL_PREFIX=/usr/local install
|
||||
sudo cp build/helloworld-c-make /usr/local/bin/
|
||||
|
||||
helloworld-c-make
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user