LinuxQuestions.org
Visit Jeremy's Blog.
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 05-25-2008, 10:13 PM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
Need Help Writing a Make Rule


Even if you don't know how to use automake, you may still be able to answer this question. Here is a snippet from a Makefile generated from qmake.
Code:
.ui/qmake_image_collection.cpp: images/filenew \
                images/fileopen \
                images/filesave \
                images/print \
                images/undo \
                images/redo \
                images/editcut \
                images/editcopy \
                images/editpaste \
                images/searchfind \
                images/options.png \
                images/designer_widgetstack.png \
                images/designer_d_table.png \
                images/designer_d_iconview.png
        $(UIC)  -embed colortool images/filenew images/fileopen images/filesave
images/print images/undo images/redo images/editcut images/editcopy images/editp
aste images/searchfind images/options.png images/designer_widgetstack.png images
/designer_d_table.png images/designer_d_iconview.png -o .ui/qmake_image_collecti
on.cpp
I'm trying to get automake to do the same thing. Here's the complete Makefile.am which contains all the rules.
Code:
bin_PROGRAMS = colortool

%.h: %.ui
        uic -o $@ $<
%.cpp: %.ui
        uic -o $@ -impl $*.h $<
# This rule lets GNU make create any moc_*.cpp from the equivalent *.h
# You have one .h file, it's called myapp.h. Therefore, here I list
# its mocced name, moc_myapp.cpp.
moc_%.cpp: %.h
        moc $< -o $@
# Turn .png files into a single .cpp files, but
# This rule doesn't work. Why?
%.cpp: %.png
        uic -embed colortool $? -o $@

# Generate image_collection.cpp from these files
image_collection.cpp: images/designer_widgetstack.png \
        images/designer_d_table.png \
        images/designer_d_iconview.png

mainwinform_UI = \
        mainwinform.h \
        mainwinform.cpp

mainwinform.h: mainwinform.ui
mainwinform.cpp: mainwinform.ui mainwinform.h

colortool_SOURCES = main.cpp mainwinform.ui.h image_collection.cpp
noinst_HEADERS = mainwinform.h
nodist_colortool_SOURCES = moc_mainwinform.cpp $(mainwinform_UI)
BUILT_SOURCES=image_collection.cpp $(mainwinform_UI)

# set the include path found by configure
INCLUDES= $(all_includes) $(QTDIR)/include

# the library search path.
colortool_LDFLAGS = $(all_libraries) -L$(QTDIR)/lib

CLEANFILES = $(nodist_colortool_SOURCES)
Uic never runs to make the image_collection.cpp file. What is wrong with my rule?
 
Old 05-27-2008, 09:15 PM   #2
theriddle
Member
 
Registered: Jun 2007
Distribution: Gentoo
Posts: 172

Rep: Reputation: 30
It looks like Make isn't matching the rule to the pattern-rule. Try setting the command directly to the target instead of using a generic rule.
 
  


Reply


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
make[1]: *** No rule to make target `modules'. Stop. tjyorkshire Linux - Hardware 27 01-14-2018 06:58 PM
make: *** No rule to make target `mrproper'. Stop. dauphinfay Linux - General 7 11-24-2014 07:35 AM
Belkin Wirless G RTL8185L make[1]: *** No rule to make target `Makefile'. Stop. SilverRock Linux - Wireless Networking 2 02-11-2007 07:25 AM
lopster v1.2.2 make error: No rule to make target `m4/glibc21.m4' Kropotkin Fedora 0 10-31-2004 11:19 AM
How to make rule for make install and make uninstall melinda_sayang Programming 1 06-14-2004 05:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:27 AM.

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
Open Source Consulting | Domain Registration