Solved

Interpreting Makefile to build library

Posted on 2004-08-16
2
290 Views
Last Modified: 2008-03-10
Hello all;

I am curious if could give me pointers on how to use a makefile to interpret what components need to be included in a project in order to build a dll or exe.

The code is C code and I would like to build it into Windows dll.

This is from the Mpg123 source code.

Thanks in advance
RJ


CC=gcc
CFLAGS=-Wall -g -DLAYER1 -DLAYER2 -DLAYER3

all: mpglib


*.o: mpg123.h mpglib.h

mpglib: layer1.o layer2.o common.o dct64_i386.o decode_i386.o layer3.o tabinit.o interface.o main.o
      $(CC) -o mpglib \
            common.o dct64_i386.o decode_i386.o layer3.o \
            tabinit.o interface.o main.o layer2.o layer1.o -lm

clean:
      rm *.o mpglib


0
Comment
Question by:RJSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 11816549
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 11816731
In

*.o: mpg123.h mpglib.h

mpglib: layer1.o layer2.o common.o dct64_i386.o decode_i386.o layer3.o tabinit.o interface.o main.o
    $(CC) -o mpglib \
         common.o dct64_i386.o decode_i386.o layer3.o \
         tabinit.o interface.o main.o layer2.o layer1.o -lm

clean:
    rm *.o mpglib

The rule for building mpglib is made dependant on the object files, which suggest that there are layer1.cpp layer2.cpp common.cpp dct64_i386.cpp decode_i386.cpp layer3.cpp tabinit.cpp interface.cpp and main.cpp (the extensions might be .cc, .C or .cxx though). I think you left out the rule that builds these .o files from the source files.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question