2015-10-16 19:55:09 -05:00
|
|
|
# 16 october 2015
|
|
|
|
|
|
|
|
OFILES = \
|
|
|
|
$(subst /,_,$(CFILES)) \
|
2015-11-17 10:49:23 -06:00
|
|
|
$(subst /,_,$(CXXFILES)) \
|
2015-10-16 19:55:09 -05:00
|
|
|
$(subst /,_,$(MFILES)) \
|
|
|
|
$(subst /,_,$(RCFILES))
|
|
|
|
|
|
|
|
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
|
|
|
|
|
|
|
|
CFLAGS += \
|
|
|
|
-g \
|
2015-11-17 18:52:05 -06:00
|
|
|
-Wall -Wextra -pedantic \
|
2015-10-16 19:55:09 -05:00
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-switch \
|
|
|
|
--std=c99
|
|
|
|
|
2015-11-17 19:01:01 -06:00
|
|
|
# C++11 is needed due to stupid rules involving commas at the end of enum lists that C++03 stupidly didn't follow
|
|
|
|
# This means sorry, no GCC 2 for Haiku builds :(
|
2015-11-17 10:49:23 -06:00
|
|
|
CXXFLAGS += \
|
|
|
|
-g \
|
2015-11-17 18:52:05 -06:00
|
|
|
-Wall -Wextra -pedantic \
|
2015-11-17 10:49:23 -06:00
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Wno-switch \
|
2015-11-17 19:01:01 -06:00
|
|
|
--std=c++11
|
2015-11-17 10:49:23 -06:00
|
|
|
|
2015-10-16 19:55:09 -05:00
|
|
|
LDFLAGS += \
|
|
|
|
-g
|
|
|
|
|
|
|
|
ifeq ($(ARCH),386)
|
|
|
|
CFLAGS += -m32
|
|
|
|
LDFLAGS += -m32
|
|
|
|
else ifeq ($(ARCH),amd64)
|
|
|
|
CFLAGS += -m64
|
|
|
|
LDFLAGS += -m64
|
|
|
|
endif
|
|
|
|
|
|
|
|
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
|
|
|
|
2015-11-17 10:49:23 -06:00
|
|
|
ifdef CXXFILES
|
|
|
|
reallinker = $(CXX)
|
|
|
|
else
|
|
|
|
reallinker = $(CC)
|
|
|
|
endif
|
|
|
|
|
2015-10-16 19:55:09 -05:00
|
|
|
$(OUT): $(OFILES) | $(OUTDIR)
|
2015-11-17 10:49:23 -06:00
|
|
|
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
2015-10-16 19:55:09 -05:00
|
|
|
@echo ====== Linked $(OUT)
|
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
$(OBJDIR)/%.c.o: $$(subst _,/,%).c $(HFILES) | $(OBJDIR)
|
|
|
|
@$(CC) -o $@ -c $< $(CFLAGS)
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
2015-11-17 10:49:23 -06:00
|
|
|
$(OBJDIR)/%.cpp.o: $$(subst _,/,%).cpp $(HFILES) | $(OBJDIR)
|
|
|
|
@$(CXX) -o $@ -c $< $(CXXFLAGS)
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
2015-10-16 19:55:09 -05:00
|
|
|
$(OBJDIR)/%.m.o: $$(subst _,/,%).m $(HFILES) | $(OBJDIR)
|
|
|
|
@$(CC) -o $@ -c $< $(CFLAGS)
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
|
|
|
$(OBJDIR)/%.rc.o: $$(subst _,/,%).rc $(HFILES) | $(OBJDIR)
|
|
|
|
@$(RC) $(RCFLAGS) $< $@
|
|
|
|
@echo ====== Compiled $<
|
|
|
|
|
|
|
|
$(OBJDIR) $(OUTDIR):
|
|
|
|
@mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OBJDIR) $(OUTDIR)
|
|
|
|
.PHONY: clean
|