1.5 KiB
1.5 KiB
Minimake
Minimake is a small project written in about a week in C99. Its goal was to reproduce the main features of the well known GNU Make utility.
Note
This is a school project, therefore it probably won't interest you if you are looking for something useful.
Build
make
or even better
minimake
How it works
If you're not familiar with Make, what it does is that it reads a file named
Makefile in the current directory which contains instructions to build a
project in the form of recipes. It includes support for variables, dependencies
, implicit rules and more.
Then depending on the user input it automatically executes a recipe with its dependencies.
Here is what a basic one can look like
BENCH_FLAGS = --all
test_and_bench:
bash ./runtests.sh
bash ./runbenchs.sh $(BENCH_FLAGS)
But it will more realisticly look like that
CC = gcc
CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla
LDFLAGS=
DBG_CFLAGS = -fsanitize=address -g
DBG_LDFLAGS= -fsanitize=address
SRC_DIR = src
LIB_SRCS = lines/lines.c hash_maps/hash_maps.c lists/lists.c files/files.c
MAIN_SRCS = main.c minimake.c
SRCS = $(MAIN_SRCS:%=$(SRC_DIR)/%) $(LIB_SRCS:%=$(SRC_DIR)/%)
OBJS = $(SRCS:.c=.o)
TARGET= minimake
DBG_TARGET = minimake-dbg
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
@echo $(OBJS)
debug: CFLAGS += $(DBG_CFLAGS)
debug: LDFLAGS += $(DBG_LDFLAGS)
debug: $(OBJS)
$(CC) -o $(DBG_TARGET) $^ $(LDFLAGS) $(LDLIBS)
check:
dash ./tests/run.sh
clean:
$(RM) $(TARGET)
$(RM) $(OBJS)