# -*- Makefile -*- # Generic makefile for ods2 # # This tries really hard to be OS-agnostic, because # otherwise, every little change means updating all # the os-specific makefiles. # # See makefile., which normally includes it # # If your make doesn't support include, these can be # specified manually, for example: # make CC=gcc "CCFLAGS=-O4 -f" OBJ=.o \ # PHYSIO=phyunix DEFS=-DUSE_READLINE LDFLAGS=-lreadline # # or just combine the files you need with an editor. # # ### # OS-Specific defines # These variables are available # Other defines = "-DDEBUG_BUILD" "-D_FILE_OFFSET_BITS=32" #DEFS = # Libraries, e.g. -lreadline #LDLIBS = # Linker flags #LDFLAGS = # Object file suffix #OBJ = .o # Executable file suffix #EXE = # Physical IO module #PHYSIO = phyunix # Extra physical IO headers #PHYSIOH = # VHD format options include $(VHDOPTS) # ##################################################### DEPENDS = makefile.depends MAKEDEPEND = makedepend SED = sed all : ods2$(EXE) SRCS = ods2.c \ access.c \ cache.c \ compat.c \ copycmd.c \ createcmd.c \ debug.c \ deletecmd.c \ device.c \ diffcmd.c \ dircmd.c \ direct.c \ dismountcmd.c \ extendcmd.c \ helpcmd.c \ importcmd.c \ initialcmd.c \ initvol.c \ mountcmd.c \ $(PHYSIO).c \ phyvirt.c \ rms.c \ searchcmd.c \ setcmd.c \ showcmd.c \ spawncmd.c \ sysmsg.c \ typecmd.c \ update.c \ vmstime.c \ $(VHDLIB) OBJS = $(SRCS:.c=$(OBJ)) depend: $(MAKEFILE_LIST) $(DELETE) $(DEPENDS) $(MAKE) -f $(TOPMAKE) $(DEPENDS) $(MAKE) -f makefile.vms descrip.mms # Used to list sourcefiles for updating VC project & git repository. # Not used for Makefile builds # Run after make depends # To get the Windows file list on Unix, use # make -f makefile.nt "DELETE=rm -f" depend vclist vclist: @echo "** Header files **" @$(SED) $(DEPENDS) -e'/ *#/d' -e's/^.*.$(OBJ): //g' -e's/ /\n/g' | sort | uniq @echo "" @echo "** Source files **" @echo $(SRCS) | sed -e's/ */\n/g' | sort | uniq # This processing is so the kit can contain a generic, up-to-date depends file # I don't want to require makedepend for people to build from source. # I do want the file to be accurate when shipped, so auto-maintained. # makedepend will include all the system library includes, which is not # helpful for this case. So the sed processing removes dependencies that # start with "/" - e.g. /usr/include and friends. $(DEPENDS): $(MAKEFILE_LIST) touch $(DEPENDS) 2>/dev/null $(MAKEDEPEND) -o$(OBJ) -I. -f- -- $(CFLAGS) $(CPPFLAGS) $(DEFS) -- $(SRCS) | $(SED) -e's/ \/[^ ]*\.h/ /g' -e'/^[^:]*: *$$/d' -e's/ */ /g' >$(DEPENDS) -include $(DEPENDS) # Currently, the descrip.mms file is updated on Unix. A makefile.vms # exists solely to enable this. It might be possible to build ODS2 # on VMS with it using GNU tools. But that's not the point. descrip.mms : $(SRCS) $(DEPENDS) $(SED) -i.bak -e's!^OBJS = .*$$!OBJS = $(SRCS:.c=)!' -e'/^# ### BEGIN RULES ###/,$$d' -e'/^OBJS =/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' descrip.mms echo "# ### BEGIN RULES ###" >>descrip.mms 2>/dev/null $(MAKEDEPEND) -o$(OBJ) -I. -f- -- $(CFLAGS) $(CPPFLAGS) $(DEFS) -- $(SRCS) | $(SED) -e's/ \/[^ ]*\.h/ /g' -e'/^[^:]*: *$$/d' -e's/ */ /g' | $(SED) -e'/^# DO NOT DELETE/d' -e's/^\([^:]*\)$(OBJ):/\1$$(OBJ):/g' -e'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' >>descrip.mms %$(OBJ): %.c $(CC) -c $(CCFLAGS) $(CPPFLAGS) $(DEFS) $< -o $@ ods2$(EXE) : $(OBJS) $(LIBS) $(CC) $(LDFLAGS) -o ods2$(EXE) $(OBJS) $(LDLIBS)