mtweidmann Posted December 2, 2003 Report Share Posted December 2, 2003 I'm doing a programming project on eCos for Uni, which means using Makefiles. So far I've okay as I've been editing one of the example files, but I can't work out how to add a file to the list of things I want to compile. The files I want to add are: fourierd.c ddc.c ddcmaths.h fftmisc.c The file with my code is called twothreads.c, and use make twothreads to compile it. The Makefile file looks like this: # Mostly written by Jonathan Larmour, Red Hat, Inc. # This file is in the public domain and may be used for any purpose # PKG_INSTALL_DIR might need to be edited. Right now it is set # assuming that a user ran pkgconf.tcl in //c/ecos-work on Windows NT, # or used the Configuration Tool with C:\ecos-work as a build-tree. # # You can also override it on the make command-line, e.g.: # make PKG_INSTALL_DIR=/myecc/install # or you can set it in your environment PKG_INSTALL_DIR = /home/genuser/ecos-work/install # You must also set XCC to the name of your cross-compiler, including any # options it needs. # Uncomment one of the below, or invoke make with the name of the compiler # you want, e.g.: # make XCC="sparclite-elf-gcc -mcpu=sparclite -msoft-float" # You can also set XCC in your environment XCC = arm-elf-gcc -mcpu=arm7di # AEB ###### VARIABLES # Any of these can be overriden on the command-line or in your environment ifeq ($(XCC),sh-elf-gcc) CFLAGS = -ggdb else CFLAGS = -g endif CXXFLAGS = $(CFLAGS) EXTRACFLAGS = -Wall -I$(PKG_INSTALL_DIR)/include -ffunction-sections -fdata-sections EXTRACXXFLAGS = $(EXTRACFLAGS) -fno-exceptions -fno-rtti -fvtable-gc -finit-priority LDFLAGS = -nostartfiles -L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections LIBS = -Ttarget.ld -nostdlib LD = $(XCC) XCXX = $(XCC) ###### RULES .PHONY: all clean CCCHECK all: hello twothreads simple-alarm serial clean: -rm -f twothreads twothreads.o -rm -f serial serial.o -rm -f instrument-test instrument-test.o CCCHECK: ifeq ($(XCC),) @echo You must set XCC to the name of your cross-compiler @false endif %.o: %.c $(XCC) -c -o $*.o $(CFLAGS) $(EXTRACFLAGS) $< %.o: %.cxx $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< %.o: %.C $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< %.o: %.cc $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $< twothreads: CCCHECK twothreads.o $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) serial: CCCHECK serial.o $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) instrument-test: CCCHECK instrument-test.o $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS) Quote Link to comment Share on other sites More sharing options...
Cannonfodder Posted December 2, 2003 Report Share Posted December 2, 2003 Do you know how the makefile is formatted? Understand the rules? If not, spend some time on it, read man, read examples. It's all in the rules section.. Quote Link to comment Share on other sites More sharing options...
Glitz Posted December 2, 2003 Report Share Posted December 2, 2003 Here is a link to a quick introduction to simple make files: http://linux.oreillynet.com/pub/a/linux/20...make_intro.html Glitz. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.