forked from vitalif/vitastor
Auto-generate C++ header dependencies
parent
5feff1ffb9
commit
73e4e30b1f
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
my $deps = {};
|
||||
for my $line (split /\n/, `grep '^#include "' *.cpp *.h`)
|
||||
{
|
||||
if ($line =~ /^([^:]+):\#include "([^"]+)"/s)
|
||||
{
|
||||
$deps->{$1}->{$2} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my $added;
|
||||
do
|
||||
{
|
||||
$added = 0;
|
||||
for my $file (keys %$deps)
|
||||
{
|
||||
for my $dep (keys %{$deps->{$file}})
|
||||
{
|
||||
if ($deps->{$dep})
|
||||
{
|
||||
for my $subdep (keys %{$deps->{$dep}})
|
||||
{
|
||||
if (!$deps->{$file}->{$subdep})
|
||||
{
|
||||
$added = 1;
|
||||
$deps->{$file}->{$subdep} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ($added);
|
||||
|
||||
for my $file (sort keys %$deps)
|
||||
{
|
||||
if ($file =~ /\.cpp$/)
|
||||
{
|
||||
my $obj = $file;
|
||||
$obj =~ s/\.cpp$/.o/s;
|
||||
print "$obj: $file ".join(" ", sort keys %{$deps->{$file}})."\n";
|
||||
print "\tg++ \$(CXXFLAGS) -c -o \$\@ \$\<\n";
|
||||
}
|
||||
}
|
150
Makefile
150
Makefile
|
@ -6,21 +6,6 @@ all: $(BLOCKSTORE_OBJS) libfio_blockstore.so osd libfio_sec_osd.so stub_osd stub
|
|||
clean:
|
||||
rm -f *.o
|
||||
|
||||
crc32c.o: crc32c.c
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
json11.o: json11/json11.cpp
|
||||
g++ $(CXXFLAGS) -c -o json11.o json11/json11.cpp
|
||||
allocator.o: allocator.cpp allocator.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
ringloop.o: ringloop.cpp ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
timerfd_interval.o: timerfd_interval.cpp timerfd_interval.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
timerfd_manager.o: timerfd_manager.cpp timerfd_manager.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.cpp allocator.h blockstore_flush.h blockstore.h blockstore_impl.h blockstore_init.h blockstore_journal.h crc32c.h ringloop.h object_id.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
dump_journal: dump_journal.cpp crc32c.o blockstore_journal.h
|
||||
g++ $(CXXFLAGS) -o $@ $< crc32c.o
|
||||
|
||||
|
@ -32,48 +17,13 @@ libfio_blockstore.so: ./libblockstore.so fio_engine.cpp json11.o
|
|||
OSD_OBJS := osd.o osd_secondary.o osd_receive.o osd_send.o osd_peering.o osd_flush.o osd_peering_pg.o \
|
||||
osd_primary.o osd_primary_subops.o etcd_state_client.o cluster_client.o osd_cluster.o http_client.o pg_states.o \
|
||||
osd_rmw.o json11.o base64.o timerfd_manager.o
|
||||
base64.o: base64.cpp base64.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_secondary.o: osd_secondary.cpp osd.h osd_ops.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_receive.o: osd_receive.cpp osd.h osd_ops.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_send.o: osd_send.cpp osd.h osd_ops.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_peering.o: osd_peering.cpp osd.h osd_ops.h osd_peering_pg.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_cluster.o: osd_cluster.cpp osd.h osd_ops.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
http_client.o: http_client.cpp http_client.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
etcd_state_client.o: etcd_state_client.cpp etcd_state_client.h http_client.h pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
cluster_client.o: cluster_client.cpp cluster_client.h osd_ops.h timerfd_manager.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_flush.o: osd_flush.cpp osd.h osd_ops.h osd_peering_pg.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_peering_pg.o: osd_peering_pg.cpp object_id.h osd_peering_pg.h pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
pg_states.o: pg_states.cpp pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_rmw.o: osd_rmw.cpp osd_rmw.h xor.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_rmw_test: osd_rmw_test.cpp osd_rmw.cpp osd_rmw.h xor.h
|
||||
g++ $(CXXFLAGS) -o $@ $<
|
||||
osd_primary.o: osd_primary.cpp osd_primary.h osd_rmw.h osd.h osd_ops.h osd_peering_pg.h xor.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_primary_subops.o: osd_primary_subops.cpp osd_primary.h osd_rmw.h osd.h osd_ops.h osd_peering_pg.h xor.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd.o: osd.cpp osd.h http_client.h osd_ops.h osd_peering_pg.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
osd: ./libblockstore.so osd_main.cpp osd.h osd_ops.h $(OSD_OBJS)
|
||||
g++ $(CXXFLAGS) -o osd osd_main.cpp $(OSD_OBJS) ./libblockstore.so -ltcmalloc_minimal -luring
|
||||
stub_osd: stub_osd.cpp osd_ops.h rw_blocking.o
|
||||
g++ $(CXXFLAGS) -o stub_osd stub_osd.cpp rw_blocking.o -ltcmalloc_minimal
|
||||
stub_bench: stub_bench.cpp osd_ops.h rw_blocking.o
|
||||
g++ $(CXXFLAGS) -o stub_bench stub_bench.cpp rw_blocking.o -ltcmalloc_minimal
|
||||
rw_blocking.o: rw_blocking.cpp rw_blocking.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_test: osd_test.cpp osd_ops.h rw_blocking.o
|
||||
g++ $(CXXFLAGS) -o osd_test osd_test.cpp rw_blocking.o -ltcmalloc_minimal
|
||||
osd_peering_pg_test: osd_peering_pg_test.cpp osd_peering_pg.o
|
||||
|
@ -88,3 +38,101 @@ test: test.cpp osd_peering_pg.o
|
|||
g++ $(CXXFLAGS) -o test test.cpp osd_peering_pg.o -luring -lm
|
||||
test_allocator: test_allocator.cpp allocator.o
|
||||
g++ $(CXXFLAGS) -o test_allocator test_allocator.cpp allocator.o
|
||||
|
||||
crc32c.o: crc32c.c crc32c.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
json11.o: json11/json11.cpp
|
||||
g++ $(CXXFLAGS) -c -o json11.o json11/json11.cpp
|
||||
|
||||
# Autogenerated
|
||||
|
||||
allocator.o: allocator.cpp allocator.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
base64.o: base64.cpp base64.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore.o: blockstore.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_flush.o: blockstore_flush.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_impl.o: blockstore_impl.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_init.o: blockstore_init.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_journal.o: blockstore_journal.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_open.o: blockstore_open.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_read.o: blockstore_read.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_rollback.o: blockstore_rollback.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_stable.o: blockstore_stable.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_sync.o: blockstore_sync.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
blockstore_write.o: blockstore_write.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
cluster_client.o: cluster_client.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
dump_journal.o: dump_journal.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
etcd_state_client.o: etcd_state_client.cpp base64.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h pg_states.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
fio_engine.o: fio_engine.cpp blockstore.h fio/fio.h fio/optgroup.h json11/json11.hpp object_id.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
fio_sec_osd.o: fio_sec_osd.cpp fio/fio.h fio/optgroup.h object_id.h osd_id.h osd_ops.h rw_blocking.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
http_client.o: http_client.cpp http_client.h json11/json11.hpp timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd.o: osd.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_cluster.o: osd_cluster.cpp base64.h blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_flush.o: osd_flush.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_main.o: osd_main.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_peering.o: osd_peering.cpp base64.h blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_peering_pg.o: osd_peering_pg.cpp cpp-btree/btree_map.h object_id.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_peering_pg_test.o: osd_peering_pg_test.cpp cpp-btree/btree_map.h object_id.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_primary.o: osd_primary.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_primary_subops.o: osd_primary_subops.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_receive.o: osd_receive.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_rmw.o: osd_rmw.cpp object_id.h osd_id.h osd_rmw.h xor.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_rmw_test.o: osd_rmw_test.cpp object_id.h osd_id.h osd_rmw.cpp osd_rmw.h test_pattern.h xor.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_secondary.o: osd_secondary.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_send.o: osd_send.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
osd_test.o: osd_test.cpp object_id.h osd_id.h osd_ops.h rw_blocking.h test_pattern.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
pg_states.o: pg_states.cpp pg_states.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
ringloop.o: ringloop.cpp ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
rw_blocking.o: rw_blocking.cpp rw_blocking.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
stub_bench.o: stub_bench.cpp object_id.h osd_id.h osd_ops.h rw_blocking.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
stub_osd.o: stub_osd.cpp object_id.h osd_id.h osd_ops.h rw_blocking.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
test.o: test.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
test_allocator.o: test_allocator.cpp allocator.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
test_blockstore.o: test_blockstore.cpp blockstore.h object_id.h ringloop.h timerfd_interval.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
test_crc.o: test_crc.cpp crc32c.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
timerfd_interval.o: timerfd_interval.cpp ringloop.h timerfd_interval.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
timerfd_manager.o: timerfd_manager.cpp timerfd_manager.h
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
|
|
Loading…
Reference in New Issue