gittup / tup

Tup is a file-based build system.
http://gittup.org/tup/
GNU General Public License v2.0
1.17k stars 144 forks source link

Tup doesn't put all the build output into .gitignore #312

Open kozross opened 7 years ago

kozross commented 7 years ago

I have the following tup-related files:

# Tuprules.tup
.gitignore

WARNINGS = -Wall -Wextra -Werror -Wfatal-errors
OPTS = -Oz -g -mtune=native -flto
EXTS = -msse4.2 -fopenmp
CC = clang
CFLAGS = -std=gnu99 $(WARNINGS) $(OPTS) $(EXTS)
LDFLAGS = -flto -fuse-ld=gold -Wl,-z,norelro
LDLIBS = -lomp

!cc = |> $(CC) $(CFLAGS) -c %f -o %o |> %B.o
!cc_fast = |> $(CC) $(CFLAGS) -DNDEBUG=1 -c %f -o %o |> %B.rel.o
!ld = |> $(CC) $(LDFLAGS) %f -o %o $(LDLIBS) |>
# Tupfile
include_rules

BLOCK_OBJ = src/block.o src/rng.o
TRUTH_TABLE_OBJ = $(BLOCK_OBJ) src/truth-table.o
PATH_OBJ = $(TRUTH_TABLE_OBJ) src/path.o src/interval.o
BDD_OBJ = $(PATH_OBJ) src/bdd.o
MAIN_OBJS = src/block.rel.o src/rng.rel.o src/truth-table.rel.o src/path.rel.o
MAIN_OBJS += src/interval.rel.o src/bdd.rel.o src/solvers.rel.o 

: src/*.c |> ctags src/*.c |> tags

: test/test-block.o $(BLOCK_OBJ) |> !ld |> test/test-block

: test/test-truth-table.o $(TRUTH_TABLE_OBJ) |> !ld |> test/test-truth-table

: test/test-path.o $(PATH_OBJ) |> !ld |> test/test-path

: test/test-bdd.o $(BDD_OBJ) |> !ld |> test/test-bdd

: main.c |> !cc_fast |> 

: main.rel.o $(MAIN_OBJS) |> !ld |> main 
# src/Tupfile
include_rules
:foreach *.c |> !cc |>
:foreach *.c |> !cc_fast |>
# test/Tupfile
include_rules
:foreach *.c |> !cc |> 

As far as I understand it, because main.rel.o, main, tags are the targets of tup rules, they should be added to the top-level .gitignore file. However, they're not there. Am I missing something obvious?

gittup commented 7 years ago

It sounds like this is the same as issue #313 - is that correct? Or do you think it's a separate problem? I reproduced your Tupfiles locally and made some stub .c files, but I'm having trouble reproducing it similar to that other issue.

kozross commented 7 years ago

I don't know what to think - I'm merely reporting what I'm seeing. Whether these are related or not is a mystery to me.

s-ol commented 6 years ago

I have the same issue, Tupfile:

.gitignore

CXXFLAGS += -Iinclude -I.
CXXFLAGS += -Wall
CXXFLAGS += -g

: foreach client/*.cpp common/*.cpp |> g++ $(CXXFLAGS) -DCLIENT -Iclient -c %f -o %o |> client/%B.o
: client/*.o |> g++ %f -o %o -lpthread -lglfw -lGL -lGLU -lpng |> bin/client

: foreach server/*.cpp common/*.cpp |> g++ $(CXXFLAGS) -DSERVER -Iserver -c %f -o %o |> server/%B.o
: server/*.o |> g++ %f -o %o -lpthread |> bin/server

and I'm getting all the object files in git.

Maybe its related to this warning I'm getting?

$ tup
tup warning: unshare(CLONE_NEWUSER) failed, and tup is not privileged. Subprocesses will have '.tup/mnt' paths for the current working directory and some dependencies may be missed.

tup is aware that they are generated though, if i remove them and run tup i see warnings like:

tup warning: generated file 'server/main.o' was deleted outside of tup. This file may be re-created on the next update.
kevinkjt2000 commented 6 years ago

I'm experiencing this error with tup 0.7.6 where cpp/*.o does not appear in the generated .gitignore.

Tupfile:

.gitignore

CXX = g++
CXXFLAGS += -std=c++11
CXXFLAGS += -O2 -g -c
CXXFLAGS += -Wall -Wextra -Werror
CXXFLAGS += -pedantic -pedantic-errors

: foreach cpp/*.cpp |> $(CXX) $(CXXFLAGS) %f -o %o |> cpp/%B.o
: cpp/*.o |> $(CXX) %f -o %o |> cpp/Main.exe

It may be related to globbing files from sub-folders? If I add touch something.cpp and add a rule:

: foreach *.cpp |> $(CXX) $(CXXFLAGS) %f -o %o |> %B.o

/something.o does appear in the generated .gitignore.