Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#==============================================================================

SRC_DIR := src

.PHONY: all clean

all:
@$(MAKE) -C $(SRC_DIR)/
@mv $(SRC_DIR)/cst_signer .
@$(MAKE) -C src

install:
@$(MAKE) -C src install

clean:
@rm -rf cst_signer src/fdt.o
@$(MAKE) -C src clean

.PHONY: all install clean
34 changes: 22 additions & 12 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,33 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#==============================================================================

CC = gcc
CC ?= gcc
CFLAGS ?= -g -Wall -Werror
CPPFLAGS ?=
LDFLAGS ?=
INCLUDES = -I../inc/

COPTS = -g -Wall -Werror
CFLAGS = -I../inc/.
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently my yocto scripts are pulling cst-singer binary and csf config files from home directory of cst-signer tool. I will not be able to apply this change in this release.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to use /usr/local for manually built applications, and /usr for packaged tools. The home directory is not suitable for this purpose.

DATADIR ?= $(PREFIX)/share

DEPS = cst_signer.h cfg_parser.h mkimage_helper.h
SRCS = cst_signer.c cfg_parser.c mkimage_helper.c fdt.o
SRCS = cst_signer.c cfg_parser.c mkimage_helper.c fdt.c

.PHONY: all clean
all: cst-signer

all: cst_signer fdt.o
%.o : %.c
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) $< -o $@

fdt.o: fdt.c
$(CC) -c -w -o $@ $< $(CFLAGS)
cst-signer: $(SRCS:.c=.o)
$(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -o $@ $(SRCS:.c=.o)

cst_signer: cst_signer.c fdt.o
$(CC) $(COPTS) $(CFLAGS) -o $@ $(SRCS)
install: cst-signer
install -D -m 0755 cst-signer $(DESTDIR)/$(BINDIR)/cst-signer
install -D -m 0755 -t $(DESTDIR)$(DATADIR)/doc/cst-signer \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand the usage of doc folder here. maybe its something I am not familiar with possibly autotools related?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .sample configuration files go to /usr/share/doc/ as

-rw-r--r-- root/root       230 2023-09-08 16:41 ./usr/share/doc/cst-signer/csf_ahab.cfg.sample
-rw-r--r-- root/root       430 2023-09-08 16:41 ./usr/share/doc/cst-signer/csf_hab4.cfg.sample

for target packages. Here for example I generated:

[0] ~/src/oe/oel/master/build/tmp/deploy/ipk/cortexa53-crypto/cst-signer-dev_0.3+0+7fa50daf32-r0_cortexa53-crypto.ipk [0]
[1] ~/src/oe/oel/master/build/tmp/deploy/ipk/cortexa53-crypto/cst-signer-doc_0.3+0+7fa50daf32-r0_cortexa53-crypto.ipk [1]
[2] ~/src/oe/oel/master/build/tmp/deploy/ipk/cortexa53-crypto/cst-signer_0.3+0+7fa50daf32-r0_cortexa53-crypto.ipk [2]
[3] ~/src/oe/oel/master/build/tmp/deploy/ipk/cortexa53-crypto/cst-signer-src_0.3+0+7fa50daf32-r0_cortexa53-crypto.ipk [3]
[4] ~/src/oe/oel/master/build/tmp/deploy/ipk/cortexa53-crypto/cst-signer-dbg_0.3+0+7fa50daf32-r0_cortexa53-crypto.ipk [4]

I understand that you use those files as templates, but in this particular case, it should be done in the native recipe. In my recipe I did this as well.

../csf_ahab.cfg.sample \
../csf_hab4.cfg.sample

clean:
rm -rf cst_signer fdt.o
rm -rf cst-signer *.o

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt DESTDIR be cleaned as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, 'clean' is not an uninstall target.


.PHONY: all install clean