I would like to alter the format of the dependency file from:
src/foo.obj : \
src/foo.h \
src/bar.h
to something like this :
src/foo.obj : src/foo.h \
src/foo.obj : src/bar.h
Is there a way to do this?
Related
I'm trying to use a Makefile to iterate over several date values and execute a python script for each one, here's the Makefile I'm using (Makefile.study.s1):
include Makefile
# Dates to test
SNAP_TST := 2019-10-12 2020-02-08 2020-10-10 2021-01-02 2021-07-24 2021-12-31 2022-05-27
buildDataset:
for date in $(SNAP_TST) ; do \
python src/_buildDataset.py --table $(TABLE) \
--nan-values $(NAN_CONFIG) \
--patterns-rmv $(PATTERNS_RMV) \
--target-bin $(TARGET_CLASS) \
--target-surv $(TARGET_SURV) \
--target-init $(TARGET_INIT) \
--train-file $(DATA_TRN) \
--test-file $(DIR_DATA)/main/churnvol_test_$$date.csv \
--train-date $(SNAP_TRN) \
--test-date $$date \
--config-input $(CONFIG_INPUT) \
--feats $(FEATS) ; \
done
.PHONY: buildDataset
When I run make -f Makefile.study.s1 buildDataset it replaces the value date with the string "$date" instead of one of the dates in SNAP_TST. Can you guys help me figure out what I did wrong here, and how I can fix this makefile so that $$date is replaced with one of the dates in SNAP_TST? Thank you in advance.
Getting this error makefile:4: *** missing separator. Stop. on this file
PROC=findcrypt
O1=consts
O2=sparse
!include ..\plugin.mak
# MAKEDEP dependency list ------------------
$(F)consts$(O) : $(I)llong.hpp $(I)pro.h consts.cpp findcrypt.hpp
$(F)findcrypt$(O): $(I)area.hpp $(I)bytes.hpp $(I)fpro.h $(I)funcs.hpp \
$(I)help.h $(I)ida.hpp $(I)idp.hpp $(I)kernwin.hpp \
$(I)lines.hpp $(I)llong.hpp $(I)loader.hpp $(I)moves.hpp \
$(I)nalt.hpp $(I)name.hpp $(I)netnode.hpp $(I)pro.h \
$(I)segment.hpp $(I)sistack.hpp $(I)ua.hpp $(I)xref.hpp \
findcrypt.cpp findcrypt.hpp
$(F)sparse$(O) : $(I)llong.hpp $(I)pro.h findcrypt.hpp sparse.cpp
I've tried using cat -e -t -v makefile to identify bad tabs but it all looks ok from what i can tell.
I have a Makefile to extract the publications for several authors from a BibTex-File and transpose them into a HTML page. I tried to create the Makefile as generic as possible, but now I'm stuck.
Here is what I have at the moment:
objects = sts-bib-*.bib
results = Author1 Author2
.PHONY : clean cleanall all $(results)
all : $(results)
$(results) : bib-$#.html
bib-%.bib :
TMPDIR=. bibtex2html-1.96-osx-x86_64/bib2bib -c 'author : "$*"' -s '$$date' source.bib
bib-%.html : bib-%.bib
TMPDIR=. bibtex2html-1.96-osx-x86_64/bibtex2html -d -r --nodoc --nobibsource --no-header --no-footer -o bib-$#.html bib-$#.bib
clean :
-rm $(objects)
When I run this, make tells me that there is nothing to be done for all. If I run it for a dedicated user, e.g. make Author1, it also tells me that for Author1 nothing is to be done. Did I do something wrong with the dependencies of the target? I also tried $(results) : bib-%.html and % : bib-%.html, all with the same result.
I think the problem lies in the dependency of the target %(result). I want something like Using make target name in generated prerequisite, but with the complete target name. So I tried % : % : sts-bib-%.html, what results in mixed implicit and static pattern rules.
Where is my mistake?
The static pattern rule is
<list of targets> : <pattern to extract stem from target> : <prereqs>
so you need to use:
$(results) : % : bib-%.html
instead of $(results) : bib-$#.html.
I'm writing an app in Vala with support to plugins. The app has the following directory structure:
data/
[data files]
m4/
my_project.m4
plugins/
example/
example.plugin.in
example-plugin.vala
Makefile.am
po/
src/
[source files]
The file "my_project.m4" dinamically adds plugin dirs with a simple defined function called MYPROJ_ADD_PLUGIN, and it works fine as I tested it with some other projects. Basically, it calls:
AC_CONFIG_FILES([plugins/example/Makefile])
[...]
AC_CONFIG_FILES([plugins/example/example.plugin])
The problem is, when I try to configure it, it gives back:
"error: cannot find input file: `plugins/example/Makefile.in'"
The example makefile (plugins/example/Makefile.am) is the following:
include $(top_srcdir)/common.am
plugin_LTLIBRARIES = example-plugin.la
plugin_DATA = example.plugin
example_plugin_la_SOURCES = \
example-plugin.vala
example_plugin_la_VALAFLAGS = \
$(MYPROJ_COMMON_VALAFLAGS) \
--target-glib=2.38
example_plugin_la_CFLAGS = \
$(MYPROJ_COMMON_CFLAGS) \
-I$(srcdir) \
-DG_LOG_DOMAIN='"Example"'
example_plugin_la_LIBADD = \
$(MYPROJ_COMMON_LIBS)
example_plugin_la_LDFLAGS = \
$(MYPROJ_PLUGIN_LINKER_FLAGS) \
-lm
EXTRA_DIST = example.plugin.in
Every var is correctly generated (in common.am and configure.ac).
I appreciate any advice on this issue.
Thanks in advance
Looks like I found the answer to my own question. Apparently, everything I had to do was add a "lib" prefix to my plugin output file. The plugins/example/Makefile.am now looks like:
include $(top_srcdir)/common.am
plugin_LTLIBRARIES = **lib**example.la
plugin_DATA = example.plugin
**lib**example_la_SOURCES = \
example-plugin.vala
**lib**example_la_VALAFLAGS = \
$(MYPROJ_COMMON_VALAFLAGS) \
--target-glib=2.38
**lib**example_la_CFLAGS = \
$(MYPROJ_COMMON_CFLAGS) \
-I$(srcdir) \
-DG_LOG_DOMAIN='"Example"'
**lib**example_la_LIBADD = \
$(MYPROJ_COMMON_LIBS)
**lib**example_la_LDFLAGS = \
$(MYPROJ_PLUGIN_LINKER_FLAGS) \
-lm
EXTRA_DIST = example.plugin.in
This was the only modification I did, and it works as expected now. Seems like autoconf/autotools is very rigid about the syntax of plugins and shared libs, as they MUST start with lib prefix.
In gcc -w is used to disable all warnings. However in this case I can't enable specific ones (e.g. -Wreturn-type).
Is it possible to disable all warnings, but enable few specific ones?
As a workaround, is there a way to generate list of all -Wno-xxx at once? And will it help? I wouldn't want to do this manually just to find out that it is not equal to -w.
You can use the following command to get an WARN_OPTS variable suitable for injecting directly into your Makefile:
gcc --help=warnings | awk '
BEGIN { print "WARN_OPTS = \\" }
/-W[^ ]/ { print $1" \\"}
' | sed 's/^-W/ -Wno-/' >makefile.inject
This gives you output (in makefile.inject) like:
WARN_OPTS = \
-Wno- \
-Wno-abi \
-Wno-address \
-Wno-aggregate-return \
-Wno-aliasing \
-Wno-align-commons \
-Wno-all \
-Wno-ampersand \
-Wno-array-bounds \
-Wno-array-temporaries \
: : :
-Wno-variadic-macros \
-Wno-vector-operation-performance \
-Wno-vla \
-Wno-volatile-register-var \
-Wno-write-strings \
-Wno-zero-as-null-pointer-constant \
Once that's put in your actual Makefile, simply use $(WARN_OPTS) as part of your gcc command.
It may need a small amount of touch up to:
get rid of invalid options such as -Wno-;
fix certain -Wno-<key>=<value> types; and
remove the final \ character.
but that's minimal effort compared to the generation of the long list, something you can now do rather simply.
When you establish that you want one of those warnings, simply switch from the -Wno-<something> back to -W<something>.