Tutorials for creating a reliable small-medium project * nix build

I am basically a spoiled Windows + Visual Studio (or Borland C ++ or something else, in the past) developer. Although my first contact with Unix was about 20 years ago, and I used Linux on-off for several years, I have only a very limited idea of ​​how to configure the build on a * nix system.

For example, I'm fine with the basics of make - I can get several files to compile and link. But I really don’t know how to configure everything to cope with several configurations - how to get all the object files and goals for the release version, to go to different folders from the debug version, etc. Etc. Yes, I can RTFM and improvise something, but it is fair to assume that I would improvise something stupid, supercomplex, fragile and WTF, where it would make much more sense to copy the general convention if I knew what the general conventions are.

In addition, I can run the configure script, and I dimly know that they are related to autoconf, whatever it is, but I have little idea if / why / how I should install such things in my own projects.

I hope this is enough to give a general idea of ​​what I'm looking for. Of course, I could ask / find specific questions here, but this assumes that I know all the right questions, which I almost certainly do not know. So - any pointers?

EDIT

Just thought I was updating this with a longer term experience.

I tried to use premake for a while, but could not live with it in the long run. To a large extent, Lua is not liked there.

cmake. makefiles/visual studio/. ( ) , , . , cmake, , , - MinGW GCC Visual Studio.

, , Windows, , -.

cmake...

  • , make /- , make . make cmake. , , make makefile , .
  • .

, ...

+3
2

Make autoconf make . ( , ) premake4. ? , GNU Makefiles, Visual Studio, Code:: Blocks . , Visual Studio, .

:

-- A solution contains projects, and defines the available configurations
solution "MyApplication"
   configurations { "Debug", "Release" }

   -- A project defines one build target
   project "MyApplication"
      kind "ConsoleApp"
      language "C++"
      files { "inc/**.h", "src/**.cpp", "main.cpp" }

      configuration "Debug"
         defines { "DEBUG" }
         flags { "Symbols" }

      configuration "Release"
         defines { "NDEBUG" }
         flags { "Optimize" }    
+3

autoconf, , , make , ...

, ( BSD GNU make) makefile . BSD 4.3 (as)

HDRS = project.h
OBJS = main.o 
LDFLAGS = 
project: ${OBJS}
    ${CC} ${LDFLAGS} ${OBJS} -o project
.c.o: ${HDRS}
    ${CC} ${CFLAGS} -c $*.c
clean:
    rm -f *.o ${OBJS} project *.core a.out errs core

Project ..

: BSD 3 Berkeley... :

 * Copyright (c) 1982 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
+1

Source: https://habr.com/ru/post/1726956/


All Articles