Mail Archives: djgpp/1996/09/23/17:07:00
This is a multi-part message in MIME format.
--------------75097E5E658D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Richard L.F. van Paasen wrote:
> I've tried to write a makefile that does the following:
>
> - take all *.cpp and *.c and *.asm files in a given directory (yes,
> all!)
> - take some named .cpp .c and .asm files
> - compile them, when they need to be compiled (ie. when header files and
> the
> source itself are changed)
> - compile the whole thing into an archive (or executable), add some libs
> and objs to it (ehh, I mean .a and .o files)
>
> But man, this seems not straightforward for a non-unix programmer. Is
> here
> someone who has written such a (generic) makefile, and who wants to
> share it
> with me (and all newbies that read this newsgroup) ? I'd be glad to
> hear.
>
> Richard van Paasen.
I'm not sure if this is quite what you're looking for , but I think it's close:
--------------75097E5E658D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="MAKEFILE"
# *Defines*
EXE_name=ed
EXE_args=test.txt
EXE_libs=-ltui -ltext -lvga -ldrvrs -lfarmem -liostream
DEBUGGER=fsdb
CPPFLAGS=@$(EXE_name).pth -MMD
CFLAGS=-Wall -Werror
CXXFLAGS=-Wall -Werror
CC=gcc
CXX=gcc
LEX=lex
ifdef DEB
CFLAGS+=-g$(DEB) -DDEBUG=$(DEB)
CXXFLAGS+=-g$(DEB) -DDEBUG=$(DEB)
ifdef OP
CFLAGS+=-O$(OP)
CXXFLAGS+=-O$(OP)
endif
else
ifdef OP
CFLAGS+=-O$(OP)
CXXFLAGS+=-O$(OP)
else
CFLAGS+=-O2
CXXFLAGS+=-O2
endif
endif
# *Implicit Rules*
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
%.cpp: %.lex
$(LEX) -l -u -msyntax.par $<
move /y lexyy.c $@
dtou $@
# *List Macros*
EXE_sources=\
formbuf0.s \
formbuf1.s \
search00.s \
search01.s \
nwmessage.c\
redirect.c \
__link.cc \
edapp.cc \
edapp0.cc \
edapp1.cc \
edapp2.cc \
edapp3.cc \
edappwin.cc\
edconfig.cc\
edcfgcol.cc\
edcfglst.cc\
editbuff.cc\
editind.cc \
editopts.cc\
editor.cc \
editor00.cc\
editor01.cc\
editor02.cc\
editor03.cc\
editwind.cc\
edoptdlg.cc\
main.cc \
memind.cc \
scrnopts.cc\
syntax.cc \
transfer.cc\
c_syntax.cpp\
cxx_syntax.cpp\
djasm_syntax.cpp\
gas_syntax.cpp\
hc11_syntax.cpp
EXE_dependencies = $(patsubst %.S,%d,$(patsubst %.s,,$(patsubst %.c,%.d,$(patsubst %.cc,%.d,$(patsubst %.cpp,%.d,$(EXE_sources))))))
EXE_objects = $(patsubst %.S,%.o,$(patsubst %.s,%.o,$(patsubst %.c,%.o,$(patsubst %.cc,%.o,$(patsubst %.cpp,%.o,$(EXE_sources))))))
# *Explicit Rules*
$(EXE_name): $(EXE_objects) ../farmem/libfarmem.a ../drivers/libdrvrs.a ../tui/libtui.a ../text/libtext.a ../vga/libvga.a
gcc @$(EXE_name).pth -o $(EXE_name) $(EXE_objects) $(EXE_libs)
noexe: $(EXE_name)
-del $(EXE_name).exe
exe: $(EXE_name)
strip $(EXE_name)
stubify $(EXE_name)
run: $(EXE_name)
-$(EXE_name) $(EXE_args)
debug: $(EXE_name)
-$(DEBUGGER) $(EXE_name) $(EXE_args)
clean:
# this is my own utility, mail me if you want it
-delete -k *.[od] ed ed.exe ed.ini *.cpp
# *Individual File Dependencies*
-include $(EXE_dependencies)
c_syntax.cpp: c_syntax.lex syntax.par
cxx_syntax.cpp: cxx_syntax.lex syntax.par
gas_syntax.cpp: gas_syntax.lex syntax.par
djasm_syntax.cpp: djasm_syntax.lex syntax.par
hc11_syntax.cpp: hc11_syntax.lex syntax.par
search00.o: search00.s editbuff.inc
search01.o: search01.s editbuff.inc
--------------75097E5E658D--
- Raw text -