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
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										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_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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user