Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #30969
| From | chris <chris-nospam@tridac.net> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Makefile or IDE? |
| Date | 2021-12-21 16:45 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <spt0b6$8lp$1@gioia.aioe.org> (permalink) |
| References | <soabn8$b4e$1@dont-email.me> <spihat$ohr$1@gioia.aioe.org> <aac8bc2e-7eed-4a97-b1e9-fecf235d9dean@googlegroups.com> |
On 12/21/21 01:18, StateMachineCOM wrote: > Would anyone point me to a good Makefile template for building a simple embedded project with GNU-ARM? I'm sure they must exist but perhaps most generate their own. Look at how others have done it, but the key is to keep it simple to start. Define a root path for sources and subdirs. same for tools and libraries. Then some simple rules to relate compiler to srcs and objects. You only need to understand the make basics to get started. The syntax is arcane and it can seem opaque in error message terms, but you just have to persevere until you have something working. Here's a snippet from a makefile here nothing clever, but try to abstract as much as possible to aid reuse. Like to keep it neat and tidy, as this aids understanding and you only need to do that once. # Local Project Directories ROOT = /export/nfs/sas8x600/system/projects/ntp-tests PRJROOT = $(ROOT)/ntp-client SRCDIR = $(PRJROOT)/src INCDIR = $(PRJROOT)/inc OBJDIR = $(PRJROOT)/obj BINDIR = $(PRJROOT)/bin LIBDIR = $(PRJROOT)/lib # Library & Test Rig PRJLIB = ntplib.a PRJBIN = ntpbin # Subsystem libraries and includes SYSINC = $(ROOT)/sysinc SYSLIB = $(ROOT)/syslib # Tools GCCROOT = /usr/local GCCINC = $(GCCROOT)/include GCCBIN = $(GCCROOT)/bin GCCLIB = $(GCCROOT)/lib GCCRTL = $(GCCLIB)/gcc/sparc-sun-solaris2.10/4.6.1 GCCOBJS = $(GCCRTL)/crt1.o $(GCCRTL)/crti.o $(GCCRTL)/crtbegin.o $(GCCRTL)/crtend.o $(GCCRTL)/crtn.o CC = $(GCCBIN)/gcc CFLAGS = -c -O2 -ansi -Wall AS = as ASFLAGS = LD = ld LDFLAGS = -L/usr/local/lib/gcc/sparc-sun-solaris2.10/4.6.1 -R/usr/local/lib -lc -lsocket -s AR = ar ARFLAGS = crvs INCLUDES = -I$(INCDIR) -I$(SYSINC) # # Dependency Search Paths # vpath %.h $(INCDIR) vpath %.c $(SRCDIR) vpath %.o $(OBJDIR) # # Rules # .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) $(INCLUDES) -c $(SRCDIR)/$< -o $(OBJDIR)/$@ # Network Function Library # LIBINCS = network.h LIBSRCS = network.c LIBOBJS = network.o # Executable Test Harness SRCS = main.c network.c OBJS = main.o network.o # Default Target: Build Library and Test Harness # default: $(LIBOBJS) $(OBJS) $(SRCS) $(AR) $(ARFLAGS) $(LIBDIR)/$(PRJLIB) $(addprefix $(OBJDIR)/, $(LIBOBJS)) $(LD) $(LDFLAGS) $(OBJDIR)/main.o $(GCCOBJS) $(LIBDIR)/$(PRJLIB) -o $(SRCDIR)/$(PRJBIN) cp $(LIBDIR)/$(PRJLIB) $(SYSLIB)/$(PRJLIB) cp $(addprefix $(INCDIR)/, $(LIBINCS)) $(SYSINC) # Start Over... # clean: rm -f $(BINDIR)/$(PRJBIN) $(OBJDIR)/*.o $(LIBDIR)/$(PRJLIB) $(SYSLIB)/$(PRJLIB) $(addprefix $(SYSINC)/, $(LIBINCS)) This wasn't for an embedded project, but nothing clever or obscure and could probably be improved, so pull it to bits if you like... Chris
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-02 12:46 +0100
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-02 15:22 +0000
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-02 17:34 +0100
Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-03 13:15 +0200
Re: Makefile or IDE? Don Y <blockedofcourse@foo.invalid> - 2021-12-02 09:48 -0700
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-02 17:34 +0100
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-03 11:49 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-03 18:27 +0100
Re: Makefile or IDE? George Neuner <gneuner2@comcast.net> - 2021-12-04 14:37 -0500
Re: Makefile or IDE? Theo <theom+news@chiark.greenend.org.uk> - 2021-12-03 20:51 +0000
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-03 21:28 +0000
Re: Makefile or IDE? George Neuner <gneuner2@comcast.net> - 2021-12-04 14:53 -0500
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 22:17 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-05 11:02 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-05 13:16 +0100
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 13:52 +0000
Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-17 17:19 +0000
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-03 23:48 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-04 10:31 +0100
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-04 16:23 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 17:41 +0100
Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-04 18:49 +0200
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 18:23 +0100
Re: Makefile or IDE? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-12-04 21:25 +0200
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-04 22:20 +0100
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 13:51 +0000
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-06 16:33 +0100
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-06 16:02 +0000
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-09 11:54 +0100
Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-10 18:35 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-10 19:44 +0100
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-11 16:18 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-11 17:06 +0100
Re: Makefile or IDE? Grant Edwards <invalid@invalid.invalid> - 2021-12-11 16:57 +0000
Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-11 18:53 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-12 14:15 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-11 10:01 +0100
Re: Makefile or IDE? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-12-11 18:47 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-12 11:27 +0100
Re: Makefile or IDE? Stefan Reuther <stefan.news@arcor.de> - 2021-12-05 11:11 +0100
Re: Makefile or IDE? David Brown <david.brown@hesbynett.no> - 2021-12-05 13:21 +0100
Re: Makefile or IDE? Dave Nadler <drn@nadler.com> - 2021-12-06 15:45 -0500
Re: Makefile or IDE? pozz <pozzugno@gmail.com> - 2021-12-09 10:43 +0100
Re: Makefile or IDE? Johann Klammer <klammerj@NOSPAM.a1.net> - 2021-12-10 09:30 +0100
Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-17 17:27 +0000
Re: Makefile or IDE? StateMachineCOM <statemachineguru@gmail.com> - 2021-12-20 17:18 -0800
Re: Makefile or IDE? chris <chris-nospam@tridac.net> - 2021-12-21 16:45 +0000
Re: Makefile or IDE? Jim Jackson <jj@franjam.org.uk> - 2021-12-21 17:40 +0000
Re: Makefile or IDE? StateMachineCOM <statemachineguru@gmail.com> - 2021-12-21 10:55 -0800
csiph-web