mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Makefile improvements.
This commit is contained in:
parent
2881fdbbfc
commit
f4e2bcdde4
4 changed files with 48 additions and 51 deletions
50
Makefile
50
Makefile
|
@ -4,62 +4,61 @@ include config.mk
|
||||||
### Module directories
|
### Module directories
|
||||||
MODULES := $(OSDIR) common
|
MODULES := $(OSDIR) common
|
||||||
|
|
||||||
### look for include files in
|
### Look for include files in each of the modules
|
||||||
### each of the modules
|
|
||||||
CPPFLAGS += $(patsubst %,-I%,$(MODULES)) $(OS)
|
CPPFLAGS += $(patsubst %,-I%,$(MODULES)) $(OS)
|
||||||
CPPFLAGS += -g
|
CPPFLAGS += -g
|
||||||
|
|
||||||
### extra libraries if required
|
### Extra libraries if required
|
||||||
LIBS :=
|
LIBS :=
|
||||||
|
|
||||||
### each module will add to this
|
### Each module will add to this
|
||||||
SRC :=
|
SRC :=
|
||||||
|
|
||||||
BIN := bin/leocad
|
BIN := bin/leocad
|
||||||
|
|
||||||
|
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean), )
|
||||||
-include $(OSDIR)/config.mk
|
-include $(OSDIR)/config.mk
|
||||||
|
endif
|
||||||
|
|
||||||
### include the description for
|
### Include the description for each module
|
||||||
### each module
|
|
||||||
include $(patsubst %,%/module.mk,$(MODULES))
|
include $(patsubst %,%/module.mk,$(MODULES))
|
||||||
|
|
||||||
### determine the object files
|
### Determine the object files
|
||||||
OBJ := \
|
OBJ := \
|
||||||
$(patsubst %.c,%.o,$(filter %.c,$(SRC))) \
|
$(patsubst %.c,%.o,$(filter %.c,$(SRC))) \
|
||||||
$(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC)))
|
$(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC)))
|
||||||
|
|
||||||
### link the program
|
### Link the program
|
||||||
.PHONY: all static
|
.PHONY: all static
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|
||||||
static: bin/leocad.static
|
static: bin/leocad.static
|
||||||
|
|
||||||
bin/leocad: $(OBJ) bin
|
bin/leocad: $(OBJ) bin Makefile
|
||||||
$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
@echo Linking $@
|
||||||
|
@$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||||
|
|
||||||
bin/leocad.static: $(OBJ) bin
|
bin/leocad.static: $(OBJ) bin Makefile
|
||||||
$(CXX) -static -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
$(CXX) -static -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
mkdir bin
|
@mkdir bin
|
||||||
|
|
||||||
### include the C/C++ include
|
### Include the C/C++ include dependencies
|
||||||
### dependencies
|
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean), )
|
||||||
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean spotless), )
|
|
||||||
-include $(OBJ:.o=.d)
|
-include $(OBJ:.o=.d)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
### calculate C/C++ include
|
### Calculate C/C++ include dependencies
|
||||||
### dependencies
|
%.d: %.cpp $(OSDIR)/config.h $(OSDIR)/config.mk
|
||||||
%.d: %.c
|
@$(CXX) -MM -MT '$(patsubst %.d,%.o, $@)' $(CXXFLAGS) $(CPPFLAGS) -w $< > $@
|
||||||
@[ -s $(OSDIR)/config.h ] || $(MAKE) config
|
|
||||||
@$(CC) -MM -MT '$(patsubst %.d,%.o, $@)' $(CFLAGS) $(CPPFLAGS) -w $< > $@
|
|
||||||
@[ -s $@ ] || rm -f $@
|
@[ -s $@ ] || rm -f $@
|
||||||
|
|
||||||
%.d: %.cpp
|
### Main compiler rule
|
||||||
@[ -s $(OSDIR)/config.h ] || $(MAKE) config
|
%.o: %.cpp $(OSDIR)/config.h $(OSDIR)/config.mk
|
||||||
@$(CXX) -MM -MT '$(patsubst %.d,%.o, $@)' $(CXXFLAGS) $(CPPFLAGS) -w $< > $@
|
@echo $<
|
||||||
|
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o '$(patsubst %.cpp,%.o, $@)' $<
|
||||||
@[ -s $@ ] || rm -f $@
|
@[ -s $@ ] || rm -f $@
|
||||||
|
|
||||||
### Various cleaning functions
|
### Various cleaning functions
|
||||||
|
@ -71,12 +70,10 @@ clean:
|
||||||
veryclean: clean
|
veryclean: clean
|
||||||
find $(MODULES) -name \*.d | xargs rm -f
|
find $(MODULES) -name \*.d | xargs rm -f
|
||||||
rm -rf bin
|
rm -rf bin
|
||||||
|
|
||||||
spotless: veryclean
|
|
||||||
rm -rf arch $(OSDIR)/config.mk $(OSDIR)/config.h
|
rm -rf arch $(OSDIR)/config.mk $(OSDIR)/config.h
|
||||||
|
|
||||||
|
|
||||||
### dependency stuff is done automatically, so these do nothing.
|
### Dependency stuff is done automatically, so these do nothing.
|
||||||
.PHONY: dep depend
|
.PHONY: dep depend
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +91,6 @@ help:
|
||||||
@echo ' a -zip or -tgz variants)'
|
@echo ' a -zip or -tgz variants)'
|
||||||
@echo ' clean'
|
@echo ' clean'
|
||||||
@echo ' veryclean'
|
@echo ' veryclean'
|
||||||
@echo ' spotless'
|
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
### Rules to make various packaging
|
### Rules to make various packaging
|
||||||
|
|
28
config.mk
28
config.mk
|
@ -135,6 +135,9 @@ config-help:
|
||||||
CONFTEST="\#include <stdio.h>\nint main() { FILE *f=fopen(\"conftestval\", \"w\");\n\
|
CONFTEST="\#include <stdio.h>\nint main() { FILE *f=fopen(\"conftestval\", \"w\");\n\
|
||||||
if (!f) return 1; fprintf(f, \"%%d\\\n\", (int)sizeof(%s)); return 0; }\n"
|
if (!f) return 1; fprintf(f, \"%%d\\\n\", (int)sizeof(%s)); return 0; }\n"
|
||||||
|
|
||||||
|
$(OSDIR)/config.h $(OSDIR)/config.mk:
|
||||||
|
make config
|
||||||
|
|
||||||
config:
|
config:
|
||||||
@echo "Automatic configuration"
|
@echo "Automatic configuration"
|
||||||
|
|
||||||
|
@ -229,11 +232,6 @@ config:
|
||||||
ac_cv_sizeof_void_p=0; \
|
ac_cv_sizeof_void_p=0; \
|
||||||
fi; \
|
fi; \
|
||||||
echo "#define LC_SIZEOF_VOID_P $$ac_cv_sizeof_void_p" >> $(OSDIR)/config.h; \
|
echo "#define LC_SIZEOF_VOID_P $$ac_cv_sizeof_void_p" >> $(OSDIR)/config.h; \
|
||||||
if test "$$ac_cv_sizeof_void_p" -eq "8"; then \
|
|
||||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(lcint64)(p))" >> $(OSDIR)/config.h; \
|
|
||||||
else \
|
|
||||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(p))" >> $(OSDIR)/config.h; \
|
|
||||||
fi; \
|
|
||||||
rm -f conftest.c conftest conftestval; \
|
rm -f conftest.c conftest conftestval; \
|
||||||
\
|
\
|
||||||
echo -n "checking size of long long... "; \
|
echo -n "checking size of long long... "; \
|
||||||
|
@ -260,6 +258,11 @@ config:
|
||||||
case 8 in \
|
case 8 in \
|
||||||
$$ac_cv_sizeof_long_long) lcint64="long long";; \
|
$$ac_cv_sizeof_long_long) lcint64="long long";; \
|
||||||
esac; \
|
esac; \
|
||||||
|
if test "$$ac_cv_sizeof_void_p" -eq "8"; then \
|
||||||
|
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(lcint64)(p))" >> $(OSDIR)/config.h; \
|
||||||
|
else \
|
||||||
|
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(p))" >> $(OSDIR)/config.h; \
|
||||||
|
fi; \
|
||||||
echo "" >> $(OSDIR)/config.h; \
|
echo "" >> $(OSDIR)/config.h; \
|
||||||
echo "typedef signed char lcint8;" >> $(OSDIR)/config.h; \
|
echo "typedef signed char lcint8;" >> $(OSDIR)/config.h; \
|
||||||
echo "typedef unsigned char lcuint8;" >> $(OSDIR)/config.h; \
|
echo "typedef unsigned char lcuint8;" >> $(OSDIR)/config.h; \
|
||||||
|
@ -333,6 +336,21 @@ ifeq ($(TEST_GTK), 1)
|
||||||
fi
|
fi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
## Check if the user has OpenGL installed
|
||||||
|
@echo -n "Checking for OpenGL support... "
|
||||||
|
@echo "#include <GL/gl.h>" > gltest.c
|
||||||
|
@echo "int main() { return 0; }" >> gltest.c
|
||||||
|
@if { (eval $(CC) gltest.c -o gltest $(CPPFLAGS) $(LDFLAGS)); } && \
|
||||||
|
(test -s gltest); then \
|
||||||
|
echo "ok"; \
|
||||||
|
else \
|
||||||
|
rm -f gltest.c gltest; \
|
||||||
|
echo "failed"; \
|
||||||
|
rm -rf $(OSDIR)/config.mk $(OSDIR)/config.h; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
@rm -f gltest.c gltest
|
||||||
|
|
||||||
## Check if the user has libjpeg installed
|
## Check if the user has libjpeg installed
|
||||||
@echo -n "Checking for jpeg support... "
|
@echo -n "Checking for jpeg support... "
|
||||||
@echo "char jpeg_read_header();" > jpegtest.c
|
@echo "char jpeg_read_header();" > jpegtest.c
|
||||||
|
|
17
linux/lc
17
linux/lc
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# set the LeoCAD library path
|
|
||||||
LEOCAD_LIB=/mnt/f/projects/leocad/windows/debug/
|
|
||||||
export LEOCAD_LIB
|
|
||||||
|
|
||||||
# run the program
|
|
||||||
./leocad
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
MAJOR := 0
|
MAJOR := 0
|
||||||
MINOR := 75
|
MINOR := 76
|
||||||
PATCHLVL := 2
|
PATCHLVL := 0
|
||||||
VERSIONTAG :=
|
VERSIONTAG :=
|
||||||
VERSION := $(MAJOR).$(MINOR).$(PATCHLVL)
|
VERSION := $(MAJOR).$(MINOR).$(PATCHLVL)
|
||||||
|
|
Loading…
Reference in a new issue