Creating makefiles in v3.x

Discussion to talk about software related topics only.
Post Reply
SeeCwriter
Posts: 605
Joined: Mon May 12, 2008 10:55 am

Creating makefiles in v3.x

Post by SeeCwriter »

Under Project Properties of Eclipse, the Builder Settings frame has a checkbox labeled "Generate Makefiles automatically", that is checked. Eclipse created two files for my project named makefile.defs and makefile.targets, but no makefile. Is that normal? All the example programs have a makefile but no .defs or .targets files.

I'm using v3.3.4.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: Creating makefiles in v3.x

Post by TomNB »

If your going to use makefiles, don't use eclipse at all. Start with any example makefile that is close to what you want, and modify your .cpp file list. For example, the ShowInterfaces makefile is below:

# Revision: 3.3.4

NAME = ShowInterfaces

CPP_SRC += \
src/main.cpp \
src/ip_util.cpp

CREATEDTARGS += src/htmldata.cpp
CPP_SRC += src/htmldata.cpp
src/htmldata.cpp : $(wildcard html/*.*)
comphtml html -osrc/htmldata.cpp

include $(NNDK_ROOT)/make/boilerplate.mk



If you wanted to add a source file named foo.cpp:


CPP_SRC += \
src/main.cpp \
src/ip_util.cpp \
src/foo.cpp


And so on. the '\' is a line continuation so you can have each file on it's own line.

The htmldata stuff is all automatic, just leave it as is. Anything you do in your project's html folder will automatically be handled.
The boilerplate.mk has all the detailed stuff for the compiler. The objective is to make something easy to use, so you only need to worry about your CPP_SRC.

If you want to use eclipse as an editor, that is fine. But if using command like makefiles, do not have eclipse manage your project or create any makefiles. The makefile docs are in the 3.3.x tool docs in the "Command Line" section.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: Creating makefiles in v3.x

Post by TomNB »

If you want to see things in action, open a command prompt, go to an example such as \nburn\examples\ShowInterfaces, and type "make -j". The -j tells the compiler to use multiple cores for the build.
Post Reply