Browse Source

add global Makefile

src/Makefile uses now 'find' for looking for *.cpp files
and we don't need Makefile.o.dep anymore
master
Tomasz Sowa 1 month ago
parent
commit
a03e3f5d21
  1. 25
      Makefile
  2. 44
      src/Makefile
  3. 80
      src/Makefile.dep
  4. 1
      src/Makefile.o.dep

25
Makefile

@ -0,0 +1,25 @@
export CXX
export CXXFLAGS
export AR
all: src
src: FORCE
$(MAKE) -C src
clean: FORCE
$(MAKE) -C src clean
depend: FORCE
$(MAKE) -C src depend
FORCE:

44
src/Makefile

@ -1,39 +1,45 @@
include Makefile.o.dep
sourcefiles:=$(shell find . -name "*.cpp")
objfiles:=$(patsubst %.cpp,%.o,$(sourcefiles))
libname=ezc.a
ifndef GLOBAL_WORKING_DIR
GLOBAL_WORKING_DIR := $(shell pwd)/../..
ifndef CXX
CXX = g++
endif
current_path := $(shell pwd)
global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WORKING_DIR))
ifndef CXXFLAGS
CXXFLAGS = -Wall -pedantic -O2 -std=c++20 -I../../pikotools/src -I/usr/local/include
endif
ifndef AR
AR = ar
endif
all: $(libname)
$(libname): $(o)
ar rcs $(libname) $(o)
libname = ezc.a
all: $(libname)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) -I$(GLOBAL_WORKING_DIR)/pikotools/src $<
$(libname): $(objfiles)
$(AR) rcs $(libname) $(objfiles)
depend:
# !! IMPROVE ME
# as Ezc is a different project we rather shoudn't use '-I$(global_relative_working_dir)/pikotools' here?
makedepend -Y. -I$(global_relative_working_dir)/pikotools/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) -o $@ $<
clean:
rm -f *.o
rm -f $(objfiles)
rm -f $(libname)
include Makefile.dep
depend:
makedepend -Y. -I../../pikotools/src -f- $(sourcefiles) > Makefile.dep
-include Makefile.dep

80
src/Makefile.dep

@ -1,41 +1,43 @@
# DO NOT DELETE
blocks.o: blocks.h item.h cache.h functions.h ../../pikotools/src/utf8/utf8.h
blocks.o: ../../pikotools/src/textstream/stream.h
blocks.o: ../../pikotools/src/utf8/utf8_templates.h
blocks.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
cache.o: cache.h item.h functions.h ../../pikotools/src/utf8/utf8.h
cache.o: ../../pikotools/src/textstream/stream.h
cache.o: ../../pikotools/src/utf8/utf8_templates.h
cache.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h blocks.h
item.o: item.h
models.o: models.h
pattern.o: pattern.h item.h cache.h functions.h
pattern.o: ../../pikotools/src/utf8/utf8.h
pattern.o: ../../pikotools/src/textstream/stream.h
pattern.o: ../../pikotools/src/utf8/utf8_templates.h
pattern.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
pattern.o: blocks.h
patternparser.o: patternparser.h blocks.h item.h cache.h functions.h
patternparser.o: ../../pikotools/src/utf8/utf8.h
patternparser.o: ../../pikotools/src/textstream/stream.h
patternparser.o: ../../pikotools/src/utf8/utf8_templates.h
patternparser.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
patternparser.o: pattern.h ../../pikotools/src/log/log.h
patternparser.o: ../../pikotools/src/textstream/textstream.h
patternparser.o: ../../pikotools/src/textstream/stream.h
patternparser.o: ../../pikotools/src/space/space.h
patternparser.o: ../../pikotools/src/textstream/types.h
patternparser.o: ../../pikotools/src/convert/inttostr.h
patternparser.o: ../../pikotools/src/date/date.h
patternparser.o: ../../pikotools/src/membuffer/membuffer.h
patternparser.o: ../../pikotools/src/textstream/types.h
patternparser.o: ../../pikotools/src/utf8/utf8_stream.h
patternparser.o: ../../pikotools/src/log/filelog.h
patternparser.o: ../../pikotools/src/convert/convert.h
patternparser.o: ../../pikotools/src/convert/inttostr.h
patternparser.o: ../../pikotools/src/convert/patternreplacer.h
patternparser.o: ../../pikotools/src/convert/strtoint.h
patternparser.o: ../../pikotools/src/convert/text.h
patternparser.o: ../../pikotools/src/convert/misc.h
patternparser.o: ../../pikotools/src/convert/double.h
./blocks.o: blocks.h item.h cache.h functions.h
./blocks.o: ../../pikotools/src/utf8/utf8.h
./blocks.o: ../../pikotools/src/textstream/stream.h
./blocks.o: ../../pikotools/src/utf8/utf8_templates.h
./blocks.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
./cache.o: cache.h item.h functions.h ../../pikotools/src/utf8/utf8.h
./cache.o: ../../pikotools/src/textstream/stream.h
./cache.o: ../../pikotools/src/utf8/utf8_templates.h
./cache.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
./cache.o: blocks.h
./item.o: item.h
./pattern.o: pattern.h item.h cache.h functions.h
./pattern.o: ../../pikotools/src/utf8/utf8.h
./pattern.o: ../../pikotools/src/textstream/stream.h
./pattern.o: ../../pikotools/src/utf8/utf8_templates.h
./pattern.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h objects.h
./pattern.o: blocks.h
./patternparser.o: patternparser.h blocks.h item.h cache.h functions.h
./patternparser.o: ../../pikotools/src/utf8/utf8.h
./patternparser.o: ../../pikotools/src/textstream/stream.h
./patternparser.o: ../../pikotools/src/utf8/utf8_templates.h
./patternparser.o: ../../pikotools/src/utf8/utf8_private.h funinfo.h
./patternparser.o: objects.h pattern.h ../../pikotools/src/log/log.h
./patternparser.o: ../../pikotools/src/textstream/textstream.h
./patternparser.o: ../../pikotools/src/textstream/stream.h
./patternparser.o: ../../pikotools/src/space/space.h
./patternparser.o: ../../pikotools/src/textstream/types.h
./patternparser.o: ../../pikotools/src/convert/inttostr.h
./patternparser.o: ../../pikotools/src/date/date.h
./patternparser.o: ../../pikotools/src/membuffer/membuffer.h
./patternparser.o: ../../pikotools/src/textstream/types.h
./patternparser.o: ../../pikotools/src/utf8/utf8_stream.h
./patternparser.o: ../../pikotools/src/log/filelog.h
./patternparser.o: ../../pikotools/src/convert/convert.h
./patternparser.o: ../../pikotools/src/convert/inttostr.h
./patternparser.o: ../../pikotools/src/convert/patternreplacer.h
./patternparser.o: ../../pikotools/src/convert/strtoint.h
./patternparser.o: ../../pikotools/src/convert/text.h
./patternparser.o: ../../pikotools/src/convert/misc.h
./patternparser.o: ../../pikotools/src/convert/double.h
./models.o: models.h

1
src/Makefile.o.dep

@ -1 +0,0 @@
o = blocks.o cache.o item.o models.o pattern.o patternparser.o
Loading…
Cancel
Save