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
making my own libraries or 3rd party libraries
-
- Posts: 18
- Joined: Wed Dec 23, 2020 3:32 am
Re: making my own libraries or 3rd party libraries
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:
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>
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
After you build the library, in your project that utilizes the library, you will add the following to your project makefile
XTRALIB += <libname>
Forrest Stanley
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
-
- Posts: 18
- Joined: Wed Dec 23, 2020 3:32 am
Re: making my own libraries or 3rd party libraries
Thanks, it worked fine!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:
By default, app is selected. You will use nblib or lib, depending on your preference.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
After you build the library, in your project that utilizes the library, you will add the following to your project makefile
XTRALIB += <libname>
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
-
- Posts: 1
- Joined: Fri Mar 05, 2021 11:50 am
Re: making my own libraries or 3rd party libraries
Thank you for such a valuable information. It is very important for me.