Page 1 of 1
making my own libraries or 3rd party libraries
Posted: Sat Feb 27, 2021 7:24 pm
by jpelletier
I'm trying to port the mcurses library from Arduino to NetBurner. With the makefile below, it compiles all the netburner code, not just this library.
I would like to use the boilerplate.mk for convenience, but how to do it to compile only my library?
My makefile contains:
NAME = mcurses
C_SRC = mcurses.c editor.c hexedit.c
include $(NNDK_ROOT)/make/boilerplate.mk
all:
$(CXX) -c mcurses.c -o mcurses.o
$(CXX) -c editor.c -o mcurses.o
$(CXX) -c hexedit.c -o mcurses.o
$(AR) -o mcurses.a mcurses.o editor.o hexedit.o
install:
cp mcurses.a ../lib
cp *.h ../include
Re: making my own libraries or 3rd party libraries
Posted: Mon Mar 01, 2021 9:37 am
by Forrest
Hello,
In your project makefile, you are going to want to set the variable TARGET_TYPE to a library. You have 3 different options for TARGET_TYPE:
Code: Select all
# Set TARGET_TYPE in your makefile to generate a target.
# Supported makefile target types: (default = app)
# nblib : build .a file and place in nburn lib directory
# lib : build .a file and place in current build directory
# app : build an _APP.s19 file and place in current directory
By default, app is selected. You will use nblib or lib, depending on your preference.
After you build the library, in your project that utilizes the library, you will add the following to your project makefile
XTRALIB += <libname>
Re: making my own libraries or 3rd party libraries
Posted: Fri Mar 05, 2021 2:13 am
by jpelletier
Forrest wrote: ↑Mon Mar 01, 2021 9:37 am
Hello,
In your project makefile, you are going to want to set the variable TARGET_TYPE to a library. You have 3 different options for TARGET_TYPE:
Code: Select all
# Set TARGET_TYPE in your makefile to generate a target.
# Supported makefile target types: (default = app)
# nblib : build .a file and place in nburn lib directory
# lib : build .a file and place in current build directory
# app : build an _APP.s19 file and place in current directory
By default, app is selected. You will use nblib or lib, depending on your preference.
After you build the library, in your project that utilizes the library, you will add the following to your project makefile
XTRALIB += <libname>
Thanks, it worked fine!
Here's my updated makefile:
TARGET_TYPE = lib
NAME = mcurses
C_SRC = mcurses.c editor.c hexedit.c
include $(NNDK_ROOT)/make/boilerplate.mk
install:
cp obj/release/mcurses.a ../lib
cp *.h ../include
Re: making my own libraries or 3rd party libraries
Posted: Fri Mar 05, 2021 11:57 am
by Sterling Johnson
Thank you for such a valuable information. It is very important for me.