LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-15-2009, 05:05 PM   #1
pgb205
Member
 
Registered: Nov 2007
Posts: 109

Rep: Reputation: 15
Makefile missing for .c file. How to create


I have a forcedeth.c (ver 0.62) code that i need to compile against a running kernel, and there are no rpms that i know for my distro(centos 5.3) Usually there is a Makefile in the directory but not this time, there is only forcedeth.c file. I'm not sure how to creat a makefile so that i could do ./configure;make;make install

thanks in advance for help.
 
Old 04-16-2009, 04:58 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,523

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
The most basic Makefile would perhaps look something like (note, this is a home-made Makefile):
Code:
SRCS   = forcedeth.c
OBJS   = $(SRCS:.c=.o)

obj-m += $(OBJS)

EXTRA_CFLAGS = -O2


all:
        $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) modules

clean:
        $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) clean
        $(RM) Module.markers modules.order
However, since I do not know anything about 'forcedeth.c' nor any dependencies it may have with other modules, I doubt this Makefile will work, but nevertheless, you may want to give it a try.

Btw, I am surprised that your kernel does not offer the forcedeth driver, since it appears that many modern Linux distros offer it with their kernels. Is it possible that your kernel has the source for 'forcedeth.c', but that it is not being built because of your kernel configuration? It would verify this first before proceeding down another path.
 
Old 04-18-2009, 04:25 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,279

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
This is the forcedeth Makefile, I found here
http://www.nvnews.net/vbulletin/showthread.php?t=96453
Code:
obj-m := forcedeth.o

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
So it seems rather simple to do, no dependencies mentioned ?
.....
 
  


Reply

Tags
create, makefile


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any tool that will create Makefile b123coder Programming 4 04-06-2006 11:00 AM
missing makefile and configure syseeker Linux - Software 4 04-04-2006 10:08 AM
Linux shell command for makefile.in to create a text file and write to it alix123 Programming 8 01-07-2005 09:18 AM
How to create a Kernel 2.6 Makefile 7.e.Q Programming 1 11-03-2004 08:47 AM
Create my own configure and Makefile Ephracis Linux - Software 1 10-11-2004 09:00 PM


All times are GMT -5. The time now is 06:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration