From 86a0bf930ec2625d48d1e60182b203226c9ee3c0 Mon Sep 17 00:00:00 2001 From: Giovanni La Mura <giovanni.lamura@inaf.it> Date: Mon, 6 Nov 2023 14:40:43 +0100 Subject: [PATCH] Move shared structures under libnptm folder --- src/Makefile | 19 ------------------- src/{ => libnptm}/Commons.cpp | 2 +- src/{ => libnptm}/Configuration.cpp | 6 +++--- src/{ => libnptm}/Parsers.cpp | 4 ++-- src/sphere/Makefile | 23 ++++++++++++++++++++++- 5 files changed, 28 insertions(+), 26 deletions(-) rename src/{ => libnptm}/Commons.cpp (98%) rename src/{ => libnptm}/Configuration.cpp (99%) rename src/{ => libnptm}/Parsers.cpp (91%) diff --git a/src/Makefile b/src/Makefile index 8e30f71d..eb107818 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,16 +1,12 @@ SUBDIRS := cluster sphere trapping SRCDIR=$(PWD) BUILDDIR=$(SRCDIR)/../build -CC=g++ all: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ -np_sphere: $(BUILDDIR)/sphere/np_sphere.o $(BUILDDIR)/sphere/Commons.o $(BUILDDIR)/sphere/Configuration.o $(BUILDDIR)/sphere/Parsers.o $(BUILDDIR)/sphere/sphere.o - $(CC) -o $(BUILDDIR)/sphere/np_sphere $(BUILDDIR)/sphere/np_sphere.o $(BUILDDIR)/sphere/Commons.o $(BUILDDIR)/sphere/Configuration.o $(BUILDDIR)/sphere/Parsers.o $(BUILDDIR)/sphere/sphere.o - clean: rm -f $(BUILDDIR)/cluster/*.o rm -f $(BUILDDIR)/sphere/*.o @@ -22,18 +18,3 @@ wipe: rm -f $(BUILDDIR)/trapping/* .PHONY: all $(SUBDIRS) - -$(BUILDDIR)/sphere/np_sphere.o: - $(CC) -c np_sphere.cpp -o $(BUILDDIR)/sphere/np_sphere.o - -$(BUILDDIR)/sphere/Commons.o: - $(CC) -c Commons.cpp -o $(BUILDDIR)/sphere/Commons.o - -$(BUILDDIR)/sphere/Configuration.o: - $(CC) -c Configuration.cpp -o $(BUILDDIR)/sphere/Configuration.o - -$(BUILDDIR)/sphere/Parsers.o: - $(CC) -c Parsers.cpp -o $(BUILDDIR)/sphere/Parsers.o - -$(BUILDDIR)/sphere/sphere.o: - $(CC) -c sphere/sphere.cpp -o $(BUILDDIR)/sphere/sphere.o diff --git a/src/Commons.cpp b/src/libnptm/Commons.cpp similarity index 98% rename from src/Commons.cpp rename to src/libnptm/Commons.cpp index d5141e07..809337ea 100644 --- a/src/Commons.cpp +++ b/src/libnptm/Commons.cpp @@ -2,7 +2,7 @@ * */ -#include "include/Commons.h" +#include "../include/Commons.h" using namespace std; diff --git a/src/Configuration.cpp b/src/libnptm/Configuration.cpp similarity index 99% rename from src/Configuration.cpp rename to src/libnptm/Configuration.cpp index 3765f449..6bb02bdd 100644 --- a/src/Configuration.cpp +++ b/src/libnptm/Configuration.cpp @@ -5,9 +5,9 @@ #include <cstdio> #include <fstream> #include <string> -#include "include/List.h" -#include "include/Parsers.h" -#include "include/Configuration.h" +#include "../include/List.h" +#include "../include/Parsers.h" +#include "../include/Configuration.h" using namespace std; diff --git a/src/Parsers.cpp b/src/libnptm/Parsers.cpp similarity index 91% rename from src/Parsers.cpp rename to src/libnptm/Parsers.cpp index 321c91df..a327df81 100644 --- a/src/Parsers.cpp +++ b/src/libnptm/Parsers.cpp @@ -3,8 +3,8 @@ #include <fstream> #include <string> -#include "include/List.h" -#include "include/Parsers.h" +#include "../include/List.h" +#include "../include/Parsers.h" std::string *load_file(std::string file_name, int *count = 0) { std::fstream input_file(file_name.c_str(), std::ios::in); diff --git a/src/sphere/Makefile b/src/sphere/Makefile index 41d1d334..c42d9b04 100644 --- a/src/sphere/Makefile +++ b/src/sphere/Makefile @@ -2,8 +2,11 @@ BUILDDIR=../../build/sphere FC=gfortran FCFLAGS=-std=legacy -O3 LFLAGS= +CXX=g++ +CXXFLAGS=-O0 -ggdb -pg -coverage +CXXLFLAGS= -all: edfb sph +all: edfb sph np_sphere edfb: edfb.o $(FC) $(FCFLAGS) -o $(BUILDDIR)/edfb $(BUILDDIR)/edfb.o $(LFLAGS) @@ -11,6 +14,24 @@ edfb: edfb.o sph: sph.o $(FC) $(FCFLAGS) -o $(BUILDDIR)/sph $(BUILDDIR)/sph.o $(LFLAGS) +np_sphere: $(BUILDDIR)/np_sphere.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o + $(CXX) $(CXXFLAGS) $(CXXLFLAGS) -o $(BUILDDIR)/np_sphere $(BUILDDIR)/np_sphere.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o + +$(BUILDDIR)/np_sphere.o: + $(CXX) $(CXXFLAGS) -c ../np_sphere.cpp -o $(BUILDDIR)/np_sphere.o + +$(BUILDDIR)/Commons.o: + $(CXX) $(CXXFLAGS) -c ../libnptm/Commons.cpp -o $(BUILDDIR)/Commons.o + +$(BUILDDIR)/Configuration.o: + $(CXX) $(CXXFLAGS) -c ../libnptm/Configuration.cpp -o $(BUILDDIR)/Configuration.o + +$(BUILDDIR)/Parsers.o: + $(CXX) $(CXXFLAGS) -c ../libnptm/Parsers.cpp -o $(BUILDDIR)/Parsers.o + +$(BUILDDIR)/sphere.o: + $(CXX) $(CXXFLAGS) -c sphere.cpp -o $(BUILDDIR)/sphere.o + clean: rm -f $(BUILDDIR)/*.o -- GitLab