How do you guys compile your larger c/c++ projects?
Writing a gnu make file by hand is ass. I can't properly figure out how it works and using cmake to make a gnu make file is also pretty ridiculous.
How do you guys compile your larger c/c++ projects?
Here you go:
# Generic GNUMakefile
# Just a snippet to stop executing under other make(1) commands
# that won't understand these lines
ifneq (,)
This makefile requires GNU Make.
endif
PROGRAM = foo
C_FILES := $(wildcard *.c)
OBJS := $(patsubst %.c, %.o, $(C_FILES))
CC = cc
CFLAGS = -Wall -pedantic
LDFLAGS =
all: $(PROGRAM)
$(PROGRAM): .depend $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM)
depend: .depend
.depend: cmd = gcc -MM -MF depend $(var); cat depend >> .depend;
.depend:
@echo "Generating dependencies..."
@$(foreach var, $(C_FILES), $(cmd))
@rm -f depend
-include .depend
# These are the pattern matching rules. In addition to the automatic
# variables used here, the variable $* that matches whatever % stands for
# can be useful in special cases.
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%: %.c
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f .depend *.o
.PHONY: clean depend
use memeson
C++ has no proper package manager either
Fucking thing sucks
build.bat
javac
cmake is ok
visual studio
I wanna rock
This.
Most projects use cmake but meson is better.
I use Qbs, which is Qt's new build system.
It's quite modern: nice declarative syntax, and it's self-contained, so it's not generating some other crap, it's doing the build itself (i.e. it replaces CMake and whatever else would be generated, like GNU make, etc.)
xcode :^)
I use CMake. Not too painful to live with and use the Visual Studio generator to make sure shit works on windows.
how do i use this?
You have to program something first.
I did. I mean how to do I call make with this ?
Do i just type make and everything will be compiled. Or do I have to specify targets.
> I can't properly figure out how it works and using cmake to make a gnu make file is also pretty ridiculous.
That's because you're a brainlet.
Yes you specify which target you what i.e:
make all
or
make clean
Use GNU autotools or cmake.
Do learn the basics of make properly, but use CMake.
>working on a large codebase from a client
>hit rebuild instead of build
>takes me a second to realize so it cleaned everything already
>1h30m gone
i ended up customizing VS to remove the rebuild button now
please like and subscribe