musigl
This commit is contained in:
parent
a4f186f61e
commit
7adc44bdb2
64
du8/Makefile
64
du8/Makefile
@ -1,59 +1,23 @@
|
|||||||
# Univerzálny Makefile pre ncurses projekt
|
CC=gcc
|
||||||
# Autor: Mišo Chlebovec
|
CFLAGS=-Wall -std=c99 -g
|
||||||
# Verzia: 1.1
|
LDFLAGS=-lncurses
|
||||||
|
|
||||||
# Kompilátor
|
|
||||||
CC = gcc
|
|
||||||
|
|
||||||
# Základné flags
|
OBJS = main.o game.o world.o
|
||||||
CFLAGS = -Wall -std=c99 -g -D_GNU_SOURCE
|
|
||||||
|
|
||||||
# Hľadanie ncurses
|
all: game
|
||||||
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")
|
|
||||||
|
|
||||||
NCURSES_LIBS = $(shell pkg-config --libs ncurses 2>/dev/null || echo "-lncurses")
|
game: $(OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o game
|
||||||
|
|
||||||
# Finalne flags
|
main.o: main.c game.h world.h
|
||||||
CFLAGS += $(NCURSES_CFLAGS)
|
$(CC) $(CFLAGS) -c main.c
|
||||||
LDFLAGS = $(NCURSES_LIBS)
|
|
||||||
|
|
||||||
# Súbory
|
game.o: game.c game.h world.h
|
||||||
SRCS = main.c game.c world.c
|
$(CC) $(CFLAGS) -c game.c
|
||||||
OBJS = $(SRCS:.c=.o)
|
|
||||||
TARGET = game
|
|
||||||
|
|
||||||
# Pravidlá
|
world.o: world.c world.h
|
||||||
all: $(TARGET)
|
$(CC) $(CFLAGS) -c world.c
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
|
||||||
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(TARGET)
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(TARGET)
|
rm -f *.o game
|
||||||
|
|
||||||
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))
|
|
||||||
|
10
du8/world.h
10
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_draw_text(int x, int y, const char* text);
|
||||||
void world_display(void);
|
void world_display(void);
|
||||||
|
|
||||||
#if __has_include(<ncurses.h>)
|
|
||||||
#include <ncurses.h>
|
|
||||||
#elif __has_include(<ncurses/ncurses.h>)
|
|
||||||
#include <ncurses/ncurses.h>
|
|
||||||
#elif __has_include(<ncursesw/ncurses.h>)
|
|
||||||
#include <ncursesw/ncurses.h>
|
|
||||||
#else
|
|
||||||
#error "ncurses.h not found in any standard location"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user