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