Created
April 29, 2014 13:08
-
-
Save sheutettz/11399803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INCDIR := inc | |
SRCDIR := src | |
OBJDIR := obj | |
#DSTDIR := . | |
EXENAME := abc.exe | |
DEBUG := -std=c99 -O3 -Wall -march=pentium -fomit-frame-pointer -fpeephole | |
#DEBUG += -pedantic | |
CFLAGS := -DNDEBUG | |
CFLAGS += -DOS_WIN=1 | |
CFLAGS += $(addprefix -I,$(strip $(shell find_not_dos $(INCDIR) -type d))) | |
LIBS := -lreadline | |
SRCS := $(notdir $(shell find_not_dos $(SRCDIR) -type f -name "*.c")) | |
OBJS := $(SRCS:.c=.o) | |
empty := | |
colon := $(empty):$(empty) | |
space := $(empty) $(empty) | |
.PHONY : all clean usage | |
.SUFFIXES: | |
%.o : %.c | |
vpath %.c $(subst $(space),$(colon),$(strip $(shell find_not_dos $(SRCDIR) -type d))) | |
vpath %.o $(OBJDIR) | |
usage : | |
@\echo $(SRCS) | |
@\echo $(OBJS) | |
@\echo $(CFLAGS) | |
@\echo "Usage: all - " | |
@\echo " build - " | |
all : $(EXENAME) | |
#install : build | |
# @if [ ! -d $(DSTDIR) ]; then \mkdir -p $(DSTDIR)/ ; fi | |
# \mv -f $(EXENAME) $(DSTDIR)/ | |
$(EXENAME) : ${OBJS} | |
\gcc -o $(EXENAME) $(addprefix $(OBJDIR)/, $(OBJS)) ${LIBS} | |
%.o : %.c | |
@if [ ! -d $(OBJDIR) ]; then \mkdir -p $(OBJDIR)/ ; fi | |
\gcc ${DEBUG} ${CFLAGS} -c -o $(OBJDIR)/$@ $< | |
clean : | |
\rm -f *.dll | |
@if [ -d $(OBJDIR) ]; then \rm -rf $(OBJDIR)/ ; fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment