diff --git a/Makefile b/Makefile index 491ab850..bbe9b959 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,10 @@ STRIP = strip + +### PLATFORM DETECTION AND CONFIGURATION ### + +# There is no uname under windows, but we can guess we are there with the COMSPEC env.var # Windows specific ifdef COMSPEC DELCOMMAND = rm -f @@ -50,6 +54,7 @@ ifdef COMSPEC ZIP = zip else +#For all other platforms, we can rely on uname PLATFORM = $(shell uname) #AmigaOS4 specific @@ -66,10 +71,9 @@ else OBJDIR = obj/amiga ZIP = lha ZIPOPT = a - else + else ifeq ($(PLATFORM),AROS) #AROS specific - ifeq ($(PLATFORM),AROS) DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir @@ -82,10 +86,9 @@ else OBJDIR = obj/aros ZIP = lha ZIPOPT = a - else + else ifeq ($(PLATFORM),MorphOS) #MorphOS specific - ifeq ($(PLATFORM),MorphOS) DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir @@ -98,10 +101,9 @@ else OBJDIR = obj/morphos ZIP = lha ZIPOPT = a - else + else ifeq ($(PLATFORM),BeOS) #BeOS specific - ifeq ($(PLATFORM),BeOS) DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir @@ -113,10 +115,9 @@ else CC = gcc OBJDIR = obj/beos ZIP = zip - else + else ifeq ($(PLATFORM),Haiku) #Haiku specific - ifeq ($(PLATFORM),Haiku) DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir @@ -128,10 +129,9 @@ else CC = gcc OBJDIR = obj/haiku ZIP = zip - else + else ifeq ($(PLATFORM),skyos) #SkyOS specific - ifeq ($(PLATFORM),skyos) DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir @@ -145,11 +145,14 @@ else ZIP = zip else - # Amiga classic - +# If we got here, we haven't found any specific system for uname. There is a little problem : Amiga 68k does not have uname ! + + # The trick here is to use the "version" command and see if the answer starts with Kickstart. This is the typical footprint of an amiga system. + # Te problem is these commands are also launched for other platforms where the "version" command is not available, so sh gives an error under linux/freebsd... $(shell version >PIPE:gfx2ver) AMIGA=$(shell sed -e s/\(Kickstart\).*/\1/g Makefile.dep +# Link the icons to the program under windows $(OBJDIR)/winres.o : gfx2.ico echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o @@ -292,6 +297,7 @@ clean : $(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES) $(DELCOMMAND) $(BIN) $(CFGBIN) +# Linux installation of the program install : $(BIN) $(CFGBIN) echo "#!/bin/sh" > $(bindir)/grafx2 echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2 @@ -310,6 +316,7 @@ install : $(BIN) $(CFGBIN) cd fonts && $(CP) * $(datadir)/grafx2/fonts/ @echo Install complete +# Linux uninstallation of the program uninstall : $(DELCOMMAND) $(bindir)/grafx2 $(DELCOMMAND) $(bindir)/gfxcfg