From 7adc44bdb297448dd7502b93c87fc46f92f0e132 Mon Sep 17 00:00:00 2001 From: Denis Landa Date: Sun, 8 Jun 2025 20:51:39 +0200 Subject: [PATCH] musigl --- du8/Makefile | 64 ++++++++++++---------------------------------------- du8/world.h | 10 -------- 2 files changed, 14 insertions(+), 60 deletions(-) diff --git a/du8/Makefile b/du8/Makefile index f008eea..b49ed2c 100644 --- a/du8/Makefile +++ b/du8/Makefile @@ -1,59 +1,23 @@ -# Univerzálny Makefile pre ncurses projekt -# Autor: Mišo Chlebovec -# Verzia: 1.1 +CC=gcc +CFLAGS=-Wall -std=c99 -g +LDFLAGS=-lncurses -# Kompilátor -CC = gcc -# Základné flags -CFLAGS = -Wall -std=c99 -g -D_GNU_SOURCE +OBJS = main.o game.o world.o -# Hľadanie ncurses -NCURSES_CFLAGS = $(shell pkg-config --cflags ncurses 2>/dev/null || \ - echo "-I/usr/include -I/usr/include/ncurses -I/usr/local/include -I/usr/local/include/ncurses") +all: game -NCURSES_LIBS = $(shell pkg-config --libs ncurses 2>/dev/null || echo "-lncurses") +game: $(OBJS) + $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o game -# Finalne flags -CFLAGS += $(NCURSES_CFLAGS) -LDFLAGS = $(NCURSES_LIBS) +main.o: main.c game.h world.h + $(CC) $(CFLAGS) -c main.c -# Súbory -SRCS = main.c game.c world.c -OBJS = $(SRCS:.c=.o) -TARGET = game +game.o: game.c game.h world.h + $(CC) $(CFLAGS) -c game.c -# Pravidlá -all: $(TARGET) - -$(TARGET): $(OBJS) - $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(TARGET) - -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ +world.o: world.c world.h + $(CC) $(CFLAGS) -c world.c clean: - rm -f $(OBJS) $(TARGET) - -distclean: clean - rm -f *~ .*swp - -# Pomocné pravidlá -.PHONY: all clean distclean - -# Automatická detekcia závislostí -DEPDIR := .deps -DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d - -COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) -c - -%.o : %.c $(DEPDIR)/%.d | $(DEPDIR) - $(COMPILE.c) $< -o $@ - -$(DEPDIR): - @mkdir -p $@ - -DEPFILES := $(SRCS:%.c=$(DEPDIR)/%.d) -$(DEPFILES): - -include $(wildcard $(DEPFILES)) + rm -f *.o game diff --git a/du8/world.h b/du8/world.h index 5e26799..c972dfb 100644 --- a/du8/world.h +++ b/du8/world.h @@ -117,14 +117,4 @@ void world_draw_char(int x, int y, char c); void world_draw_text(int x, int y, const char* text); void world_display(void); -#if __has_include() - #include -#elif __has_include() - #include -#elif __has_include() - #include -#else - #error "ncurses.h not found in any standard location" -#endif - #endif