473,320 Members | 2,189 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

makefile problems, undefining objects

i have 3 drivers,

bst:
gcc -o bst -D BST driver3.c parser.c bst.c common.c

ll2:
gcc -o ll2 -U BST driver2.c parser.c ll.c common.c

ll1:
gcc -o ll1 -U BST driver1.c parser.c ll.c common.c

i know this is fine and it works for what i am doing but i want to create object files. however if i do the following

commonbst.o:
gcc -D BST -Wall -ansi -pedantic -c common.c
commonll.o:
gcc -U BST -Wall -ansi -pedantic -c common.c
that to is also fine, however once either of them is compiled it creates a common.o which is now uptodate can i remove a objects file in complilton some how thanks
Jan 25 '08 #1
1 1479
RRick
463 Expert 256MB
In make files, you get to do most of the work. To remove object files, most implementations create a "clean" target that removes unwanted things.

Also, you can use something call a suffix command to automatically create the object files.

Expand|Select|Wrap|Line Numbers
  1. ##  Compile command
  2. %.o: %.cpp
  3.     gcc -o $@  -c -Wall $<
  4.  
  5. ##  clean up
  6. clean: 
  7.     rm bst *.o
  8.  
  9. ##  Compile bst
  10. bst: driver3.o parser.o common.o
  11.     gcc -o   $@   $^
To recompile bst, you simple type: make clean bst
Jan 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
1
by: Jamie Saker | last post by:
I think I'm overlooking something assumed in socket's makefile method. Googling several hours and digging thru the python reference didn't help - I think I'm overlooking an assumption between...
4
by: Sharp Tool | last post by:
Hi I have downloaded a program that is written in C++ that I would like to compile into a Win XP executable. The program contains a Makefile written for Unix/linux/cygwin. I would like to...
2
by: Juhan Voolaid | last post by:
Hello I need help with my makefile, so that when I compile my project the source code files would be separated from the object (*.o) files. So if I have: main.cpp and classes.cpp - the...
4
by: Jess | last post by:
Hello, I am now trying to use makefile to compile C++ programs. My makefile looks like: f1.o : f1.cpp h1.h h2.h g++ -c f1.cpp f2.o : f2.cpp h2.h h3.h g++ -c f2.cpp
6
by: ahlongxp | last post by:
socket.makefile() may lose data when "connection reset by peer". and socket.recv() will never lose the data. change the "1" to "0" in the client code to see the difference. confirmed on both...
3
by: simbasaurus | last post by:
Hello! I am trying to write a simple makefile that compiles some C++ sources from ~/testmake/src and places the object files in ~/testmake/obj. The makefile looks like this: CC=g++...
0
by: jewel87 | last post by:
Hi everyone, I'm trying to write a makefile with a conditional statement that uses a variable to specify a C compiler which may be cc or gcc. I am basically using the example we were given in the...
16
by: tvnaidu | last post by:
Looking for simple Makefile to make shared lib (.so) in Linux (I have two C files file1.c and file2.c, also two static libs slib1.a and slib2.a), can I get Makefile to compile all of them to crate...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.