Skip to contentSkip to conversation

migrating manual makefile to autotools-based packages

Buildroot aurelien coulaud 3 participants 5 messages Apr 6, 2016 – Apr 28, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I am using an old buildroot 2011 with external packages using manual makefiles.

Now I am migrating to buildroot 2016.02 and this doc
(http://free-electrons.com/~thomas/buildroot/manual/html/ch11.html) explains that manual makefile are now obsolete.

and the official doc of buildroot does not mention manual makefile :
https://buildroot.org/downloads/manual/manual.html

manual makefile is not supported on 2016.02, I am right ? Is there a way to continue to use manual makefile?

Otherwise is there a tool to migrate easily manual makefile to autotools-based ?

Thank you for your answer.
Best regards,

AC

#1 lore raw
Quoted 4 lines · aurelien coulaud

Hello,

I am using an old buildroot 2011 with external packages using manual

makefiles.

Quoted 5 lines

Now I am migrating to buildroot 2016.02 and this doc
(http://free-electrons.com/~thomas/buildroot/manual/html/ch11.html) explains that manual makefile are now obsolete.

Quoted 7 lines

and the official doc of buildroot does not mention manual makefile :
https://buildroot.org/downloads/manual/manual.html

manual makefile is not supported on 2016.02, I am right ? Is there a way to continue to use manual makefile?

Otherwise is there a tool to migrate easily manual makefile to

autotools-based ?

Quoted 6 lines

Thank you for your answer.
Best regards,

AC

hello I found the solution into this slides (page 272):
http://free-electrons.com/doc/training/buildroot/buildroot-slides.pdf

"Note: as of Buildroot 2015.05,
TARGETS
has been renamed to
PACKAGES"

So now my old Package with manual makefile compiles.

Bye,

#2 lore raw

Hello,

Quoted 9 lines · aurelien coulaud

hello I found the solution into this slides (page 272):
http://free-electrons.com/doc/training/buildroot/buildroot-slides.pdf

"Note: as of Buildroot 2015.05,
TARGETS
has been renamed to
PACKAGES"

So now my old Package with manual makefile compiles.

Using hand-written Makefiles is bad, as you lose many features of the package infrastructure: legal-info, source, source-check, etc. Please don't use hand-written Makefiles, use one of the available package infrastructures. Doing the conversion is generally very easy. If you don't know how to do it, please post your current .mk file and we'll give you some hints.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw
Quoted 11 lines

Using hand-written Makefiles is bad, as you lose many features of the package infrastructure: legal-info, source, source-check, etc. Please don't use hand-written Makefiles, use one of the available package infrastructures. Doing the conversion is generally very easy. If you don't know how to do it, please post your current .mk file and we'll give you some hints.

Best regards,

Thomas

Hello Thomas, thank in advance.

Here is my file: codebase.mk

#############################################################
#

# codebase
#
#############################################################

CODEBASE_SOURCE=codebase__20061027.tgz
CODEBASE_DIR:=$(BUILD_DIR)/codebase

$(CODEBASE_DIR)/.source: $(DL_DIR)/$(CODEBASE_SOURCE)

	$(ZCAT) $(DL_DIR)/$(CODEBASE_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(CODEBASE_DIR) package/codebase/ patch*
	touch $(CODEBASE_DIR)/.source

$(CODEBASE_DIR)/.configured: $(CODEBASE_DIR)/.source

	(cd $(CODEBASE_DIR); \
	export PATH="/usr/local/bin:$(PATH)" ; \
	./bootstrap ; \
        $(TARGET_CONFIGURE_OPTS) \
	CPPFLAGS=-DS4NO_FCVT \
        CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
        LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
	./configure \
	--target=$(GNU_TARGET_NAME) \
	--host=$(GNU_TARGET_NAME) \
	--build=$(GNU_HOST_NAME) \
	--prefix=/usr );
	touch $(CODEBASE_DIR)/.configured

$(CODEBASE_DIR)/.compiled: $(CODEBASE_DIR)/.configured

	        $(MAKE) -C $(CODEBASE_DIR)
	        touch $(CODEBASE_DIR)/.compiled

$(STAGING_DIR)/usr/lib/libcb.so: $(CODEBASE_DIR)/.compiled

	$(MAKE) -C $(CODEBASE_DIR) install prefix=$(STAGING_DIR)/usr
exec_prefix=$(STAGING_DIR)/usr
	touch -c $(STAGING_DIR)/usr/lib/libcb.so

$(TARGET_DIR)/usr/lib/libcb.so: $(STAGING_DIR)/usr/lib/libcb.so

	cp -dpf $(STAGING_DIR)/usr/lib/libcb* $(STAGING_DIR)/usr/lib/libcbx*
$(TARGET_DIR)/usr/lib/
	-$(STRIP) --strip-unneeded \
		$(TARGET_DIR)/usr/lib/libcb.so \
		$(TARGET_DIR)/usr/lib/libcbx.so \

codebase: $(TARGET_DIR)/usr/lib/libcb.so

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_CODEBASE)),y)
TARGETS+=codebase
endif

#4 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"aurelien" == aurelien coulaud <[email protected]> writes:

Hello Thomas, thank in advance.

Here is my file: codebase.mk

This looks like a pretty normal autotools based package. Look at E.G. package/libdaemon/libdaemon.mk for an example.

Quoted 6 lines

#############################################################
#

# codebase
#
#############################################################
Quoted 8 lines

CODEBASE_SOURCE=codebase__20061027.tgz
CODEBASE_DIR:=$(BUILD_DIR)/codebase

$(CODEBASE_DIR)/.source: $(DL_DIR)/$(CODEBASE_SOURCE)

	$(ZCAT) $(DL_DIR)/$(CODEBASE_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(CODEBASE_DIR) package/codebase/ patch*
	touch $(CODEBASE_DIR)/.source

This is all handled by the infrastructure if you define something like:

CODEBASE_VERSION = 20061027
CODEBASE_SOURCE = codebase__$(CODEBASE_VERSION).tgz

Quoted 4 lines

$(CODEBASE_DIR)/.configured: $(CODEBASE_DIR)/.source

	(cd $(CODEBASE_DIR); \
	export PATH="/usr/local/bin:$(PATH)" ; \
	./bootstrap ; \

I take it that bootstrap runs autoreconf - If so, you can tell buildroot to do so with:

CODEBASE_AUTORECONF = YES

Quoted 4 lines
        $(TARGET_CONFIGURE_OPTS) \
	CPPFLAGS=-DS4NO_FCVT \
        CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
        LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \

STAGING_DIR should already be in CFLAGS/LDFLAGS.

Quoted 7 lines
	./configure \
	--target=$(GNU_TARGET_NAME) \
	--host=$(GNU_TARGET_NAME) \
	--build=$(GNU_HOST_NAME) \
	--prefix=/usr );
	touch $(CODEBASE_DIR)/.configured
Quoted 8 lines

$(CODEBASE_DIR)/.compiled: $(CODEBASE_DIR)/.configured

	        $(MAKE) -C $(CODEBASE_DIR)
	        touch $(CODEBASE_DIR)/.compiled

$(STAGING_DIR)/usr/lib/libcb.so: $(CODEBASE_DIR)/.compiled

	$(MAKE) -C $(CODEBASE_DIR) install prefix=$(STAGING_DIR)/usr
exec_prefix=$(STAGING_DIR)/usr
	touch -c $(STAGING_DIR)/usr/lib/libcb.so

This looks odd. Are you sure you don't just want to do:

make -C $(CODEBASE_DIR) DESTDIR=$(STAGING_DIR) install

If so, that's what buildroot does by default.

Quoted 6 lines

$(TARGET_DIR)/usr/lib/libcb.so: $(STAGING_DIR)/usr/lib/libcb.so

	cp -dpf $(STAGING_DIR)/usr/lib/libcb* $(STAGING_DIR)/usr/lib/libcbx*
$(TARGET_DIR)/usr/lib/
	-$(STRIP) --strip-unneeded \
		$(TARGET_DIR)/usr/lib/libcb.so \
		$(TARGET_DIR)/usr/lib/libcbx.so \

And here it does the same except it passes DESTDIR=$(TARGET_DIR)

Signature · 1 line
Bye, Peter Korsgaard