diff --git a/btn/c/.gitignore b/btn/c/.gitignore index 86c5f69..f802e99 100644 --- a/btn/c/.gitignore +++ b/btn/c/.gitignore @@ -1,5 +1,7 @@ btn btn.exe -btn.o -.dat \ No newline at end of file +*.o +*.d + +.dat diff --git a/btn/c/Makefile b/btn/c/Makefile index 53dd418..36d2d13 100644 --- a/btn/c/Makefile +++ b/btn/c/Makefile @@ -1,15 +1,41 @@ -CC = gcc -CCFLAGS = -O -Wall -W -pedantic +## Variables ## +TARGET := btn -TARGET = btn +CC := gcc +CFLAGS := -O -Wall -W -pedantic +CFLAGS += -g +CFLAGS += -MMD -MP +CPPFLAGS = \ + -I $(DIR_LIB) \ + -DPROGNAME='"$(TARGET)"' -SOURCES = $(wildcard ./*.c) -OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) +SOURCES = $(wildcard *.c) +LIB_SRCS = $(wildcard $(DIR_LIB)/*.c) +OBJECTS = $(SOURCES:.c=.o) +LIB_OBJS = $(notdir $(LIB_SRCS:.c=.o)) +DIR_LIB := ../../lib + +## Targets ## +.PHONY: all clean + +## Default Goal ## all: $(TARGET) -$(TARGET): $(OBJECTS) - $(CC) $(CCFLAGS) -o $@ $^ +## Build ## +$(TARGET): $(OBJECTS) $(LIB_OBJS) + $(CC) $^ $(CFLAGS) -o $@ + +$(OBJECTS): %.o: %.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +$(LIB_OBJS): %.o: $(DIR_LIB)/%.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +## Dependency ## +-include $(OBJECTS:.o=.d) +-include $(LIB_OBJS:.o=.d) -%.o: %.c - $(CC) $(CCFLAGS) -c -o $@ $< +## Tasks ## +clean: + rm -f $(TARGET) *.o *.d diff --git a/hd/c/.gitignore b/hd/c/.gitignore index 82026ae..1310530 100644 --- a/hd/c/.gitignore +++ b/hd/c/.gitignore @@ -1,4 +1,7 @@ -tmp hd hd.exe -hd.o \ No newline at end of file + +*.o +*.d + +tmp diff --git a/hd/c/Makefile b/hd/c/Makefile index 8dedf72..6605b13 100644 --- a/hd/c/Makefile +++ b/hd/c/Makefile @@ -1,15 +1,41 @@ -CC = gcc -CCFLAGS = -O -Wall -W -pedantic +## Variables ## +TARGET := hd -TARGET = hd +CC := gcc +CFLAGS := -O -Wall -W -pedantic +CFLAGS += -g +CFLAGS += -MMD -MP +CPPFLAGS = \ + -I $(DIR_LIB) \ + -DPROGNAME='"$(TARGET)"' -SOURCES = $(wildcard ./*.c) -OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) +SOURCES = $(wildcard *.c) +LIB_SRCS = $(wildcard $(DIR_LIB)/*.c) +OBJECTS = $(SOURCES:.c=.o) +LIB_OBJS = $(notdir $(LIB_SRCS:.c=.o)) +DIR_LIB := ../../lib + +## Targets ## +.PHONY: all clean + +## Default Goal ## all: $(TARGET) -$(TARGET): $(OBJECTS) - $(CC) $(CCFLAGS) -o $@ $^ +## Build ## +$(TARGET): $(OBJECTS) $(LIB_OBJS) + $(CC) $^ $(CFLAGS) -o $@ + +$(OBJECTS): %.o: %.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +$(LIB_OBJS): %.o: $(DIR_LIB)/%.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +## Dependency ## +-include $(OBJECTS:.o=.d) +-include $(LIB_OBJS:.o=.d) -%.o: %.c - $(CC) $(CCFLAGS) -c -o $@ $< +## Tasks ## +clean: + rm -f $(TARGET) *.o *.d diff --git a/hhss/c/.gitignore b/hhss/c/.gitignore index 6dfabfe..2c7bfbe 100644 --- a/hhss/c/.gitignore +++ b/hhss/c/.gitignore @@ -1,4 +1,5 @@ hhss hhss.exe + *.o *.d diff --git a/nsy/c/.gitignore b/nsy/c/.gitignore index 2103688..45879fb 100644 --- a/nsy/c/.gitignore +++ b/nsy/c/.gitignore @@ -1,5 +1,7 @@ nsy nsy.exe -nsy.o -.dat \ No newline at end of file +*.o +*.d + +.dat diff --git a/nsy/c/Makefile b/nsy/c/Makefile index 9deb712..52bf45b 100644 --- a/nsy/c/Makefile +++ b/nsy/c/Makefile @@ -1,15 +1,41 @@ -CC = gcc -CCFLAGS = -O -Wall -W -pedantic +## Variables ## +TARGET := nsy -TARGET = nsy +CC := gcc +CFLAGS := -O -Wall -W -pedantic +CFLAGS += -g +CFLAGS += -MMD -MP +CPPFLAGS = \ + -I $(DIR_LIB) \ + -DPROGNAME='"$(TARGET)"' -SOURCES = $(wildcard ./*.c) -OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) +SOURCES = $(wildcard *.c) +LIB_SRCS = $(wildcard $(DIR_LIB)/*.c) +OBJECTS = $(SOURCES:.c=.o) +LIB_OBJS = $(notdir $(LIB_SRCS:.c=.o)) +DIR_LIB := ../../lib + +## Targets ## +.PHONY: all clean + +## Default Goal ## all: $(TARGET) -$(TARGET): $(OBJECTS) - $(CC) $(CCFLAGS) -o $@ $^ +## Build ## +$(TARGET): $(OBJECTS) $(LIB_OBJS) + $(CC) $^ $(CFLAGS) -o $@ + +$(OBJECTS): %.o: %.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +$(LIB_OBJS): %.o: $(DIR_LIB)/%.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +## Dependency ## +-include $(OBJECTS:.o=.d) +-include $(LIB_OBJS:.o=.d) -%.o: %.c - $(CC) $(CCFLAGS) -c -o $@ $< +## Tasks ## +clean: + rm -f $(TARGET) *.o *.d diff --git a/nsy2/c/.gitignore b/nsy2/c/.gitignore index 4e44f2f..935da00 100644 --- a/nsy2/c/.gitignore +++ b/nsy2/c/.gitignore @@ -1,2 +1,5 @@ nsy2 -nsy2.o \ No newline at end of file +nsy2.exe + +*.o +*.d diff --git a/nsy2/c/Makefile b/nsy2/c/Makefile index acf9434..9c6b5f8 100644 --- a/nsy2/c/Makefile +++ b/nsy2/c/Makefile @@ -1,15 +1,41 @@ -CC = gcc -CCFLAGS = -O -Wall -W -pedantic +## Variables ## +TARGET := nsy2 -TARGET = nsy2 +CC := gcc +CFLAGS := -O -Wall -W -pedantic +CFLAGS += -g +CFLAGS += -MMD -MP +CPPFLAGS = \ + -I $(DIR_LIB) \ + -DPROGNAME='"$(TARGET)"' -SOURCES = $(wildcard ./*.c) -OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) +SOURCES = $(wildcard *.c) +LIB_SRCS = $(wildcard $(DIR_LIB)/*.c) +OBJECTS = $(SOURCES:.c=.o) +LIB_OBJS = $(notdir $(LIB_SRCS:.c=.o)) +DIR_LIB := ../../lib + +## Targets ## +.PHONY: all clean + +## Default Goal ## all: $(TARGET) -$(TARGET): $(OBJECTS) - $(CC) $(CCFLAGS) -o $@ $^ +## Build ## +$(TARGET): $(OBJECTS) $(LIB_OBJS) + $(CC) $^ $(CFLAGS) -o $@ + +$(OBJECTS): %.o: %.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +$(LIB_OBJS): %.o: $(DIR_LIB)/%.c + $(CC) $< $(CPPFLAGS) $(CFLAGS) -c -o $@ + +## Dependency ## +-include $(OBJECTS:.o=.d) +-include $(LIB_OBJS:.o=.d) -%.o: %.c - $(CC) $(CCFLAGS) -c -o $@ $< +## Tasks ## +clean: + rm -f $(TARGET) *.o *.d diff --git a/test/.gitignore b/test/.gitignore index 5c369ed..6a0b763 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,3 +1,4 @@ test test_maker -test_maker.o + +*.o diff --git a/yandere/c/.gitignore b/yandere/c/.gitignore index 1f6c70d..4ae7d1e 100644 --- a/yandere/c/.gitignore +++ b/yandere/c/.gitignore @@ -1,4 +1,5 @@ yandere yandere.exe + *.o *.d